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
BSONObj expectedResult() { return BSON("" << 10LL); }
0
[ "CWE-835" ]
mongo
0a076417d1d7fba3632b73349a1fd29a83e68816
128,689,098,464,600,200,000,000,000,000,000,000,000
3
SERVER-38070 fix infinite loop in agg expression
void RGWListBuckets_ObjStore_SWIFT::handle_listing_chunk(RGWUserBuckets&& buckets) { if (wants_reversed) { /* Just store in the reversal buffer. Its content will be handled later, * in send_response_end(). */ reverse_buffer.emplace(std::begin(reverse_buffer), std::move(buckets)); } else { return send_response_data(buckets); } }
0
[ "CWE-617" ]
ceph
f44a8ae8aa27ecef69528db9aec220f12492810e
10,204,849,441,236,054,000,000,000,000,000,000,000
10
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)
parse_set_tunnel(char *arg, struct ofpbuf *ofpacts, enum ofp_raw_action_type raw) { struct ofpact_tunnel *tunnel; tunnel = ofpact_put_SET_TUNNEL(ofpacts); tunnel->ofpact.raw = raw; return str_to_u64(arg, &tunnel->tun_id); }
0
[ "CWE-125" ]
ovs
9237a63c47bd314b807cda0bd2216264e82edbe8
332,052,595,220,560,080,000,000,000,000,000,000,000
9
ofp-actions: Avoid buffer overread in BUNDLE action decoding. Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9052 Signed-off-by: Ben Pfaff <[email protected]> Acked-by: Justin Pettit <[email protected]>
_dbus_geteuid (void) { return geteuid (); }
0
[ "CWE-404" ]
dbus
872b085f12f56da25a2dbd9bd0b2dff31d5aea63
157,312,035,519,349,920,000,000,000,000,000,000,000
4
sysdeps-unix: On MSG_CTRUNC, close the fds we did receive MSG_CTRUNC indicates that we have received fewer fds that we should have done because the buffer was too small, but we were treating it as though it indicated that we received *no* fds. If we received any, we still have to make sure we close them, otherwise they will be leaked. On the system bus, if an attacker can induce us to leak fds in this way, that's a local denial of service via resource exhaustion. Reported-by: Kevin Backhouse, GitHub Security Lab Fixes: dbus#294 Fixes: CVE-2020-12049 Fixes: GHSL-2020-057
column_format_type column_format() const { return (column_format_type) ((flags >> FIELD_FLAGS_COLUMN_FORMAT) & 3); }
0
[ "CWE-416", "CWE-703" ]
server
08c7ab404f69d9c4ca6ca7a9cf7eec74c804f917
255,784,059,926,223,250,000,000,000,000,000,000,000
5
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]>
rpc_C_EncryptUpdate (CK_X_FUNCTION_LIST *self, p11_rpc_message *msg) { CK_SESSION_HANDLE session; CK_BYTE_PTR part; CK_ULONG part_len; CK_BYTE_PTR encrypted_part; CK_ULONG encrypted_part_len; BEGIN_CALL (EncryptUpdate); IN_ULONG (session); IN_BYTE_ARRAY (part, part_len); IN_BYTE_BUFFER (encrypted_part, encrypted_part_len); PROCESS_CALL ((self, session, part, part_len, encrypted_part, &encrypted_part_len)); OUT_BYTE_ARRAY (encrypted_part, encrypted_part_len); END_CALL; }
0
[ "CWE-190" ]
p11-kit
5307a1d21a50cacd06f471a873a018d23ba4b963
31,982,219,995,934,030,000,000,000,000,000,000,000
17
Check for arithmetic overflows before allocating
static void cli_session_setup_gensec_remote_next(struct tevent_req *req) { struct cli_session_setup_gensec_state *state = tevent_req_data(req, struct cli_session_setup_gensec_state); struct tevent_req *subreq = NULL; if (state->remote_ready) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } subreq = cli_sesssetup_blob_send(state, state->ev, state->cli, state->blob_out); if (tevent_req_nomem(subreq, req)) { return; } tevent_req_set_callback(subreq, cli_session_setup_gensec_remote_done, req); }
0
[ "CWE-94" ]
samba
94295b7aa22d2544af5323bca70d3dcb97fd7c64
220,053,344,368,334,800,000,000,000,000,000,000,000
21
CVE-2016-2019: s3:libsmb: add comment regarding smbXcli_session_is_guest() with mandatory signing BUG: https://bugzilla.samba.org/show_bug.cgi?id=11860 Signed-off-by: Stefan Metzmacher <[email protected]>
static RRBNode *_node_new(void *data, RRBNode *parent) { RRBNode *node = R_NEW0 (RRBNode); r_return_val_if_fail (node, NULL); node->red = 1; node->data = data; node->parent = parent; return node; }
0
[ "CWE-416" ]
radare2
b5cb90b28ec71fda3504da04e3cc94a362807f5e
20,089,131,847,790,557,000,000,000,000,000,000,000
10
Prefer memleak over usaf in io.bank's rbtree bug ##crash * That's a workaround, proper fix will come later * Reproducer: bins/fuzzed/iobank-crash * Reported by Akyne Choi via huntr.dev
static void foreach_pairs(RCore *core, const char *cmd, const char *each) { const char *arg; int pair = 0; for (arg = each ; ; ) { char *next = strchr (arg, ' '); if (next) { *next = 0; } if (arg && *arg) { ut64 n = r_num_get (NULL, arg); if (pair%2) { r_core_block_size (core, n); r_core_cmd0 (core, cmd); } else { r_core_seek (core, n, 1); } pair++; } if (!next) { break; } arg = next + 1; } }
0
[ "CWE-78" ]
radare2
dd739f5a45b3af3d1f65f00fe19af1dbfec7aea7
116,321,753,187,279,440,000,000,000,000,000,000,000
24
Fix #14990 - multiple quoted command parsing issue ##core > "?e hello""?e world" hello world" > "?e hello";"?e world" hello world
static int mxf_absolute_bodysid_offset(MXFContext *mxf, int body_sid, int64_t offset, int64_t *offset_out, MXFPartition **partition_out) { MXFPartition *last_p = NULL; int a, b, m, m0; if (offset < 0) return AVERROR(EINVAL); a = -1; b = mxf->partitions_count; while (b - a > 1) { m0 = m = (a + b) >> 1; while (m < b && mxf->partitions[m].body_sid != body_sid) m++; if (m < b && mxf->partitions[m].body_offset <= offset) a = m; else b = m0; } if (a >= 0) last_p = &mxf->partitions[a]; if (last_p && (!last_p->essence_length || last_p->essence_length > (offset - last_p->body_offset))) { *offset_out = last_p->essence_offset + (offset - last_p->body_offset); if (partition_out) *partition_out = last_p; return 0; } av_log(mxf->fc, AV_LOG_ERROR, "failed to find absolute offset of %"PRIX64" in BodySID %i - partial file?\n", offset, body_sid); return AVERROR_INVALIDDATA; }
0
[ "CWE-125" ]
FFmpeg
bab0716c7f4793ec42e05a5aa7e80d82a0dd4e75
39,944,972,965,673,147,000,000,000,000,000,000,000
39
avformat/mxfdec: Fix av_log context Fixes: out of array access Fixes: mxf-crash-1c2e59bf07a34675bfb3ada5e1ec22fa9f38f923 Found-by: Paul Ch <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]>
static int moverect_user(VTermRect dest, VTermRect src, void *user) { VTermScreen *screen = user; if(screen->callbacks && screen->callbacks->moverect) { if(screen->damage_merge != VTERM_DAMAGE_SCROLL) // Avoid an infinite loop vterm_screen_flush_damage(screen); if((*screen->callbacks->moverect)(dest, src, screen->cbdata)) return 1; } damagerect(screen, dest); return 1; }
0
[ "CWE-476" ]
vim
cd929f7ba8cc5b6d6dcf35c8b34124e969fed6b8
140,158,794,569,572,350,000,000,000,000,000,000,000
17
patch 8.1.0633: crash when out of memory while opening a terminal window Problem: Crash when out of memory while opening a terminal window. Solution: Handle out-of-memory more gracefully.
uECC_VLI_API uECC_word_t uECC_vli_add(uECC_word_t *result, const uECC_word_t *left, const uECC_word_t *right, wordcount_t num_words) { uECC_word_t carry = 0; wordcount_t i; for (i = 0; i < num_words; ++i) { uECC_word_t sum = left[i] + right[i] + carry; if (sum != left[i]) { carry = (sum < left[i]); } result[i] = sum; } return carry; }
0
[ "CWE-415" ]
micro-ecc
1b5f5cea5145c96dd8791b9b2c41424fc74c2172
283,635,745,809,201,500,000,000,000,000,000,000,000
15
Fix for #168
real_save_jpeg (GdkPixbuf *pixbuf, gchar **keys, gchar **values, GError **error, gboolean to_callback, FILE *f, GdkPixbufSaveFunc save_func, gpointer user_data) { /* FIXME error handling is broken */ struct jpeg_compress_struct cinfo; guchar *buf = NULL; guchar *ptr; guchar *pixels = NULL; JSAMPROW *jbuf; int y = 0; volatile int quality = 75; /* default; must be between 0 and 100 */ int i, j; int w, h = 0; int rowstride = 0; int n_channels; struct error_handler_data jerr; ToFunctionDestinationManager to_callback_destmgr; int x_density = 0; int y_density = 0; gchar *icc_profile = NULL; gchar *data; gint retval = TRUE; gsize icc_profile_size = 0; to_callback_destmgr.buffer = NULL; if (keys && *keys) { gchar **kiter = keys; gchar **viter = values; while (*kiter) { if (strcmp (*kiter, "quality") == 0) { char *endptr = NULL; quality = strtol (*viter, &endptr, 10); if (endptr == *viter) { g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_BAD_OPTION, _("JPEG quality must be a value between 0 and 100; value '%s' could not be parsed."), *viter); retval = FALSE; goto cleanup; } if (quality < 0 || quality > 100) { /* This is a user-visible error; * lets people skip the range-checking * in their app. */ g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_BAD_OPTION, _("JPEG quality must be a value between 0 and 100; value '%d' is not allowed."), quality); retval = FALSE; goto cleanup; } } else if (strcmp (*kiter, "x-dpi") == 0) { char *endptr = NULL; x_density = strtol (*viter, &endptr, 10); if (endptr == *viter) x_density = -1; if (x_density <= 0 || x_density > 65535) { /* This is a user-visible error; * lets people skip the range-checking * in their app. */ g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_BAD_OPTION, _("JPEG x-dpi must be a value between 1 and 65535; value '%s' is not allowed."), *viter); retval = FALSE; goto cleanup; } } else if (strcmp (*kiter, "y-dpi") == 0) { char *endptr = NULL; y_density = strtol (*viter, &endptr, 10); if (endptr == *viter) y_density = -1; if (y_density <= 0 || y_density > 65535) { /* This is a user-visible error; * lets people skip the range-checking * in their app. */ g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_BAD_OPTION, _("JPEG y-dpi must be a value between 1 and 65535; value '%s' is not allowed."), *viter); retval = FALSE; goto cleanup; } } else if (strcmp (*kiter, "icc-profile") == 0) { /* decode from base64 */ icc_profile = (gchar*) g_base64_decode (*viter, &icc_profile_size); if (icc_profile_size < 127) { /* This is a user-visible error */ g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_BAD_OPTION, _("Color profile has invalid length '%u'."), (guint) icc_profile_size); retval = FALSE; goto cleanup; } } else { g_warning ("Unrecognized parameter (%s) passed to JPEG saver.", *kiter); } ++kiter; ++viter; } } rowstride = gdk_pixbuf_get_rowstride (pixbuf); n_channels = gdk_pixbuf_get_n_channels (pixbuf); w = gdk_pixbuf_get_width (pixbuf); h = gdk_pixbuf_get_height (pixbuf); pixels = gdk_pixbuf_get_pixels (pixbuf); /* Guaranteed by the caller. */ g_assert (w >= 0); g_assert (h >= 0); g_assert (rowstride >= 0); g_assert (n_channels >= 0); /* Allocate a small buffer to convert image data, * and a larger buffer if doing to_callback save. */ buf = g_try_malloc (w * 3 * sizeof (guchar)); if (!buf) { g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for loading JPEG file")); retval = FALSE; goto cleanup; } if (to_callback) { to_callback_destmgr.buffer = g_try_malloc (TO_FUNCTION_BUF_SIZE); if (!to_callback_destmgr.buffer) { g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for loading JPEG file")); retval = FALSE; goto cleanup; } } /* set up error handling */ cinfo.err = jpeg_std_error (&(jerr.pub)); jerr.pub.error_exit = fatal_error_handler; jerr.pub.output_message = output_message_handler; jerr.error = error; if (sigsetjmp (jerr.setjmp_buffer, 1)) { jpeg_destroy_compress (&cinfo); retval = FALSE; goto cleanup; } /* setup compress params */ jpeg_create_compress (&cinfo); if (to_callback) { to_callback_destmgr.pub.init_destination = to_callback_init; to_callback_destmgr.pub.empty_output_buffer = to_callback_empty_output_buffer; to_callback_destmgr.pub.term_destination = to_callback_terminate; to_callback_destmgr.error = error; to_callback_destmgr.save_func = save_func; to_callback_destmgr.user_data = user_data; cinfo.dest = (struct jpeg_destination_mgr*) &to_callback_destmgr; } else { jpeg_stdio_dest (&cinfo, f); } cinfo.image_width = w; cinfo.image_height = h; cinfo.input_components = 3; cinfo.in_color_space = JCS_RGB; /* set up jepg compression parameters */ jpeg_set_defaults (&cinfo); jpeg_set_quality (&cinfo, quality, TRUE); /* set density information */ if (x_density > 0 && y_density > 0) { cinfo.density_unit = 1; /* Dots per inch */ cinfo.X_density = x_density; cinfo.Y_density = y_density; } jpeg_start_compress (&cinfo, TRUE); /* write ICC profile data */ if (icc_profile != NULL) { /* optimise for the common case where only one APP2 segment is required */ if (icc_profile_size < 0xffef) { data = g_new (gchar, icc_profile_size + 14); memcpy (data, "ICC_PROFILE\000\001\001", 14); memcpy (data + 14, icc_profile, icc_profile_size); jpeg_write_marker (&cinfo, JPEG_APP0+2, (const JOCTET *) data, icc_profile_size + 14); g_free (data); } else { guint segments; guint size = 0xffef; guint offset; segments = (guint) ceilf ((gfloat) icc_profile_size / (gfloat) 0xffef); data = g_new (gchar, 0xffff); memcpy (data, "ICC_PROFILE\000", 12); data[13] = segments; for (i=0; i<=segments; i++) { data[12] = i; offset = 0xffef * i; /* last segment */ if (i == segments) size = icc_profile_size % 0xffef; memcpy (data + 14, icc_profile + offset, size); jpeg_write_marker (&cinfo, JPEG_APP0+2, (const JOCTET *) data, size + 14); } g_free (data); } } /* get the start pointer */ ptr = pixels; /* go one scanline at a time... and save */ i = 0; while (cinfo.next_scanline < cinfo.image_height) { /* convert scanline from ARGB to RGB packed */ for (j = 0; j < w; j++) memcpy (&(buf[j*3]), &(ptr[(gsize)i*rowstride + j*n_channels]), 3); /* write scanline */ jbuf = (JSAMPROW *)(&buf); if (jpeg_write_scanlines (&cinfo, jbuf, 1) == 0) { jpeg_destroy_compress (&cinfo); retval = FALSE; goto cleanup; } i++; y++; } /* finish off */ jpeg_finish_compress (&cinfo); jpeg_destroy_compress(&cinfo); cleanup: g_free (buf); g_free (to_callback_destmgr.buffer); g_free (icc_profile); return retval; }
0
[ "CWE-787" ]
gdk-pixbuf
c2a40a92fe3df4111ed9da51fe3368c079b86926
100,354,098,769,178,200,000,000,000,000,000,000,000
276
jpeg: Throw error when number of color components is unsupported Explicitly check "3" or "4" output color components. gdk-pixbuf assumed that the value of output_components to be either 3 or 4, but not an invalid value (9) or an unsupported value (1). The way the buffer size was deduced was using a naive "== 4" check, with a 1, 3 or 9 color component picture getting the same buffer size, a size just sufficient for 3 color components, causing invalid writes later when libjpeg-turbo was decoding the image. CVE-2017-2862 Sent by from Marcin 'Icewall' Noga of Cisco Talos https://bugzilla.gnome.org/show_bug.cgi?id=784866
void DL_Dxf::writeComment(DL_WriterA& dw, const std::string& comment) { dw.dxfString(999, comment); }
0
[ "CWE-191" ]
qcad
1eeffc5daf5a06cf6213ffc19e95923cdebb2eb8
208,679,995,453,488,620,000,000,000,000,000,000,000
3
check vertexIndex which might be -1 for broken DXF
static void tda8425_setmode(struct CHIPSTATE *chip, int mode) { int s1 = chip->shadow.bytes[TDA8425_S1+1] & 0xe1; if (mode & V4L2_TUNER_MODE_LANG1) { s1 |= TDA8425_S1_ML_SOUND_A; s1 |= TDA8425_S1_STEREO_PSEUDO; } else if (mode & V4L2_TUNER_MODE_LANG2) { s1 |= TDA8425_S1_ML_SOUND_B; s1 |= TDA8425_S1_STEREO_PSEUDO; } else { s1 |= TDA8425_S1_ML_STEREO; if (mode & V4L2_TUNER_MODE_MONO) s1 |= TDA8425_S1_STEREO_MONO; if (mode & V4L2_TUNER_MODE_STEREO) s1 |= TDA8425_S1_STEREO_SPATIAL; } chip_write(chip,TDA8425_S1,s1); }
0
[ "CWE-399" ]
linux-2.6
01a1a3cc1e3fbe718bd06a2a5d4d1a2d0fb4d7d9
222,367,751,528,633,500,000,000,000,000,000,000,000
22
V4L/DVB (9624): CVE-2008-5033: fix OOPS on tvaudio when controlling bass/treble This bug were supposed to be fixed by 5ba2f67afb02c5302b2898949ed6fc3b3d37dcf1, where a call to NULL happens. Not all tvaudio chips allow controlling bass/treble. So, the driver has a table with a flag to indicate if the chip does support it. Unfortunately, the handling of this logic were broken for a very long time (probably since the first module version). Due to that, an OOPS were generated for devices that don't support bass/treble. This were the resulting OOPS message before the patch, with debug messages enabled: tvaudio' 1-005b: VIDIOC_S_CTRL BUG: unable to handle kernel NULL pointer dereference at 00000000 IP: [<00000000>] *pde = 22fda067 *pte = 00000000 Oops: 0000 [#1] SMP Modules linked in: snd_hda_intel snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_hwdep snd soundcore tuner_simple tuner_types tea5767 tuner tvaudio bttv bridgebnep rfcomm l2cap bluetooth it87 hwmon_vid hwmon fuse sunrpc ipt_REJECT nf_conntrack_ipv4 iptable_filter ip_tables ip6t_REJECT xt_tcpudp nf_conntrack_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables x_tables ipv6 dm_mirrordm_multipath dm_mod configfs videodev v4l1_compat ir_common 8139cp compat_ioctl32 v4l2_common 8139too videobuf_dma_sg videobuf_core mii btcx_risc tveeprom i915 button snd_page_alloc serio_raw drm pcspkr i2c_algo_bit i2c_i801 i2c_core iTCO_wdt iTCO_vendor_support sr_mod cdrom sg ata_generic pata_acpi ata_piix libata sd_mod scsi_mod ext3 jbdmbcache uhci_hcd ohci_hcd ehci_hcd [last unloaded: soundcore] Pid: 15413, comm: qv4l2 Not tainted (2.6.25.14-108.fc9.i686 #1) EIP: 0060:[<00000000>] EFLAGS: 00210246 CPU: 0 EIP is at 0x0 EAX: 00008000 EBX: ebd21600 ECX: e2fd9ec4 EDX: 00200046 ESI: f8c0f0c4 EDI: f8c0f0c4 EBP: e2fd9d50 ESP: e2fd9d2c DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068 Process qv4l2 (pid: 15413, ti=e2fd9000 task=ebe44000 task.ti=e2fd9000) Stack: f8c0c6ae e2ff2a00 00000d00 e2fd9ec4 ebc4e000 e2fd9d5c f8c0c448 00000000 f899c12a e2fd9d5c f899c154 e2fd9d68 e2fd9d80 c0560185 e2fd9d88 f8f3e1d8 f8f3e1dc ebc4e034 f8f3e18c e2fd9ec4 00000000 e2fd9d90 f899c286 c008561c Call Trace: [<f8c0c6ae>] ? chip_command+0x266/0x4b6 [tvaudio] [<f8c0c448>] ? chip_command+0x0/0x4b6 [tvaudio] [<f899c12a>] ? i2c_cmd+0x0/0x2f [i2c_core] [<f899c154>] ? i2c_cmd+0x2a/0x2f [i2c_core] [<c0560185>] ? device_for_each_child+0x21/0x49 [<f899c286>] ? i2c_clients_command+0x1c/0x1e [i2c_core] [<f8f283d8>] ? bttv_call_i2c_clients+0x14/0x16 [bttv] [<f8f23601>] ? bttv_s_ctrl+0x1bc/0x313 [bttv] [<f8f23445>] ? bttv_s_ctrl+0x0/0x313 [bttv] [<f8b6096d>] ? __video_do_ioctl+0x1f84/0x3726 [videodev] [<c05abb4e>] ? sock_aio_write+0x100/0x10d [<c041b23e>] ? kmap_atomic_prot+0x1dd/0x1df [<c043a0c9>] ? enqueue_hrtimer+0xc2/0xcd [<c04f4fa4>] ? copy_from_user+0x39/0x121 [<f8b622b9>] ? __video_ioctl2+0x1aa/0x24a [videodev] [<c04054fd>] ? do_notify_resume+0x768/0x795 [<c043c0f7>] ? getnstimeofday+0x34/0xd1 [<c0437b77>] ? autoremove_wake_function+0x0/0x33 [<f8b62368>] ? video_ioctl2+0xf/0x13 [videodev] [<c048c6f0>] ? vfs_ioctl+0x50/0x69 [<c048c942>] ? do_vfs_ioctl+0x239/0x24c [<c048c995>] ? sys_ioctl+0x40/0x5b [<c0405bf2>] ? syscall_call+0x7/0xb [<c0620000>] ? cpuid4_cache_sysfs_exit+0x3d/0x69 ======================= Code: Bad EIP value. EIP: [<00000000>] 0x0 SS:ESP 0068:e2fd9d2c Signed-off-by: Mauro Carvalho Chehab <[email protected]>
static void __init do_add_efi_memmap(void) { efi_memory_desc_t *md; for_each_efi_memory_desc(md) { unsigned long long start = md->phys_addr; unsigned long long size = md->num_pages << EFI_PAGE_SHIFT; int e820_type; switch (md->type) { case EFI_LOADER_CODE: case EFI_LOADER_DATA: case EFI_BOOT_SERVICES_CODE: case EFI_BOOT_SERVICES_DATA: case EFI_CONVENTIONAL_MEMORY: if (md->attribute & EFI_MEMORY_WB) e820_type = E820_TYPE_RAM; else e820_type = E820_TYPE_RESERVED; break; case EFI_ACPI_RECLAIM_MEMORY: e820_type = E820_TYPE_ACPI; break; case EFI_ACPI_MEMORY_NVS: e820_type = E820_TYPE_NVS; break; case EFI_UNUSABLE_MEMORY: e820_type = E820_TYPE_UNUSABLE; break; case EFI_PERSISTENT_MEMORY: e820_type = E820_TYPE_PMEM; break; default: /* * EFI_RESERVED_TYPE EFI_RUNTIME_SERVICES_CODE * EFI_RUNTIME_SERVICES_DATA EFI_MEMORY_MAPPED_IO * EFI_MEMORY_MAPPED_IO_PORT_SPACE EFI_PAL_CODE */ e820_type = E820_TYPE_RESERVED; break; } e820__range_add(start, size, e820_type); } e820__update_table(e820_table); }
0
[ "CWE-388" ]
tip
4e78921ba4dd0aca1cc89168f45039add4183f8e
262,624,270,445,455,680,000,000,000,000,000,000,000
45
efi/x86/Add missing error handling to old_memmap 1:1 mapping code The old_memmap flow in efi_call_phys_prolog() performs numerous memory allocations, and either does not check for failure at all, or it does but fails to propagate it back to the caller, which may end up calling into the firmware with an incomplete 1:1 mapping. So let's fix this by returning NULL from efi_call_phys_prolog() on memory allocation failures only, and by handling this condition in the caller. Also, clean up any half baked sets of page tables that we may have created before returning with a NULL return value. Note that any failure at this level will trigger a panic() two levels up, so none of this makes a huge difference, but it is a nice cleanup nonetheless. [ardb: update commit log, add efi_call_phys_epilog() call on error path] Signed-off-by: Gen Zhang <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rob Bradford <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
void smb_vfs_call_init_search_op(struct vfs_handle_struct *handle, DIR *dirp) { VFS_FIND(init_search_op); handle->fns->init_search_op_fn(handle, dirp); }
0
[ "CWE-264" ]
samba
4278ef25f64d5fdbf432ff1534e275416ec9561e
144,773,984,225,321,800,000,000,000,000,000,000,000
6
CVE-2015-5252: s3: smbd: Fix symlink verification (file access outside the share). Ensure matching component ends in '/' or '\0'. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11395 Signed-off-by: Jeremy Allison <[email protected]> Reviewed-by: Volker Lendecke <[email protected]>
CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw) { cJSON *item = cJSON_New_Item(&global_hooks); if(item) { item->type = cJSON_Raw; item->valuestring = (char*)cJSON_strdup((const unsigned char*)raw, &global_hooks); if(!item->valuestring) { cJSON_Delete(item); return NULL; } } return item; }
0
[ "CWE-754", "CWE-787" ]
cJSON
be749d7efa7c9021da746e685bd6dec79f9dd99b
258,203,819,130,600,000,000,000,000,000,000,000,000
16
Fix crash of cJSON_GetObjectItemCaseSensitive when calling it on arrays
static int matchlabel(js_Ast *node, const char *label) { while (node && node->type == STM_LABEL) { if (!strcmp(node->a->string, label)) return 1; node = node->parent; } return 0; }
0
[ "CWE-476" ]
mujs
5008105780c0b0182ea6eda83ad5598f225be3ee
264,251,875,672,443,030,000,000,000,000,000,000,000
9
Fix 697172: degenerate labeled break/continue statement. A labeled break statement will look for a matching label through its chain of parent statements. We start looking at the break statement though, so if the label is attached to the break, we'll return the break statement itself as a break target. Start looking for targets one level up instead.
int jpc_mqenc_codemps2(jpc_mqenc_t *mqenc) { /* Note: This function only performs part of the work associated with the CODEMPS algorithm from the standard. Some of the work is also performed by the caller. */ jpc_mqstate_t *state = *(mqenc->curctx); if (mqenc->areg < state->qeval) { mqenc->areg = state->qeval; } else { mqenc->creg += state->qeval; } *mqenc->curctx = state->nmps; jpc_mqenc_renorme(mqenc->areg, mqenc->creg, mqenc->ctreg, mqenc); return jpc_mqenc_error(mqenc) ? (-1) : 0; }
0
[ "CWE-189" ]
jasper
3c55b399c36ef46befcb21e4ebc4799367f89684
148,764,936,067,939,530,000,000,000,000,000,000,000
16
At many places in the code, jas_malloc or jas_recalloc was being invoked with the size argument being computed in a manner that would not allow integer overflow to be detected. Now, these places in the code have been modified to use special-purpose memory allocation functions (e.g., jas_alloc2, jas_alloc3, jas_realloc2) that check for overflow. This should fix many security problems.
batchState2String(batch_state_t state) { switch(state) { case BATCH_STATE_RDY: return "BATCH_STATE_RDY"; case BATCH_STATE_BAD: return "BATCH_STATE_BAD"; case BATCH_STATE_SUB: return "BATCH_STATE_SUB"; case BATCH_STATE_COMM: return "BATCH_STATE_COMM"; case BATCH_STATE_DISC: return "BATCH_STATE_DISC"; } return "ERROR, batch state not known!"; }
0
[ "CWE-772", "CWE-401" ]
rsyslog
1ef709cc97d54f74d3fdeb83788cc4b01f4c6a2a
270,872,909,415,522,020,000,000,000,000,000,000,000
15
bugfix: fixed a memory leak and potential abort condition this could happen if multiple rulesets were used and some output batches contained messages belonging to more than one ruleset. fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=226 fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=218
static int vfat_unlink(struct inode *dir, struct dentry *dentry) { struct inode *inode = dentry->d_inode; struct super_block *sb = dir->i_sb; struct fat_slot_info sinfo; int err; lock_super(sb); err = vfat_find(dir, &dentry->d_name, &sinfo); if (err) goto out; err = fat_remove_entries(dir, &sinfo); /* and releases bh */ if (err) goto out; clear_nlink(inode); inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC; fat_detach(inode); out: unlock_super(sb); return err; }
0
[ "CWE-119", "CWE-787" ]
linux
0720a06a7518c9d0c0125bd5d1f3b6264c55c3dd
94,993,559,329,527,090,000,000,000,000,000,000,000
24
NLS: improve UTF8 -> UTF16 string conversion routine The utf8s_to_utf16s conversion routine needs to be improved. Unlike its utf16s_to_utf8s sibling, it doesn't accept arguments specifying the maximum length of the output buffer or the endianness of its 16-bit output. This patch (as1501) adds the two missing arguments, and adjusts the only two places in the kernel where the function is called. A follow-on patch will add a third caller that does utilize the new capabilities. The two conversion routines are still annoyingly inconsistent in the way they handle invalid byte combinations. But that's a subject for a different patch. Signed-off-by: Alan Stern <[email protected]> CC: Clemens Ladisch <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
striter_dealloc(striterobject *it) { _PyObject_GC_UNTRACK(it); Py_XDECREF(it->it_seq); PyObject_GC_Del(it); }
0
[ "CWE-190" ]
cpython
6c004b40f9d51872d848981ef1a18bb08c2dfc42
311,896,028,399,738,660,000,000,000,000,000,000,000
6
bpo-30657: Fix CVE-2017-1000158 (#4758) Fixes possible integer overflow in PyBytes_DecodeEscape. Co-Authored-By: Jay Bosamiya <[email protected]>
lowerstr_ctx(IspellDict *Conf, const char *src) { MemoryContext saveCtx; char *dst; saveCtx = MemoryContextSwitchTo(Conf->buildCxt); dst = lowerstr(src); MemoryContextSwitchTo(saveCtx); return dst; }
0
[ "CWE-119" ]
postgres
01824385aead50e557ca1af28640460fa9877d51
237,217,816,005,343,600,000,000,000,000,000,000,000
11
Prevent potential overruns of fixed-size buffers. Coverity identified a number of places in which it couldn't prove that a string being copied into a fixed-size buffer would fit. We believe that most, perhaps all of these are in fact safe, or are copying data that is coming from a trusted source so that any overrun is not really a security issue. Nonetheless it seems prudent to forestall any risk by using strlcpy() and similar functions. Fixes by Peter Eisentraut and Jozef Mlich based on Coverity reports. In addition, fix a potential null-pointer-dereference crash in contrib/chkpass. The crypt(3) function is defined to return NULL on failure, but chkpass.c didn't check for that before using the result. The main practical case in which this could be an issue is if libc is configured to refuse to execute unapproved hashing algorithms (e.g., "FIPS mode"). This ideally should've been a separate commit, but since it touches code adjacent to one of the buffer overrun changes, I included it in this commit to avoid last-minute merge issues. This issue was reported by Honza Horak. Security: CVE-2014-0065 for buffer overruns, CVE-2014-0066 for crypt()
variable_exists(char_u *name, size_t len, cctx_T *cctx) { return (cctx != NULL && (lookup_local(name, len, NULL, cctx) == OK || arg_exists(name, len, NULL, NULL, NULL, cctx) == OK)) || script_var_exists(name, len, cctx) == OK || find_imported(name, len, cctx) != NULL; }
0
[ "CWE-416" ]
vim
9c23f9bb5fe435b28245ba8ac65aa0ca6b902c04
234,274,023,840,875,270,000,000,000,000,000,000,000
8
patch 8.2.3902: Vim9: double free with nested :def function Problem: Vim9: double free with nested :def function. Solution: Pass "line_to_free" from compile_def_function() and make sure cmdlinep is valid.
void do_notify_resume(struct pt_regs *regs, long in_syscall) { if (test_thread_flag(TIF_SIGPENDING) || test_thread_flag(TIF_RESTORE_SIGMASK)) do_signal(regs, in_syscall); if (test_thread_flag(TIF_NOTIFY_RESUME)) { clear_thread_flag(TIF_NOTIFY_RESUME); tracehook_notify_resume(regs); } }
1
[]
linux-2.6
ee18d64c1f632043a02e6f5ba5e045bb26a5465f
59,503,171,509,773,630,000,000,000,000,000,000,000
11
KEYS: Add a keyctl to install a process's session keyring on its parent [try #6] Add a keyctl to install a process's session keyring onto its parent. This replaces the parent's session keyring. Because the COW credential code does not permit one process to change another process's credentials directly, the change is deferred until userspace next starts executing again. Normally this will be after a wait*() syscall. To support this, three new security hooks have been provided: cred_alloc_blank() to allocate unset security creds, cred_transfer() to fill in the blank security creds and key_session_to_parent() - which asks the LSM if the process may replace its parent's session keyring. The replacement may only happen if the process has the same ownership details as its parent, and the process has LINK permission on the session keyring, and the session keyring is owned by the process, and the LSM permits it. Note that this requires alteration to each architecture's notify_resume path. This has been done for all arches barring blackfin, m68k* and xtensa, all of which need assembly alteration to support TIF_NOTIFY_RESUME. This allows the replacement to be performed at the point the parent process resumes userspace execution. This allows the userspace AFS pioctl emulation to fully emulate newpag() and the VIOCSETTOK and VIOCSETTOK2 pioctls, all of which require the ability to alter the parent process's PAG membership. However, since kAFS doesn't use PAGs per se, but rather dumps the keys into the session keyring, the session keyring of the parent must be replaced if, for example, VIOCSETTOK is passed the newpag flag. This can be tested with the following program: #include <stdio.h> #include <stdlib.h> #include <keyutils.h> #define KEYCTL_SESSION_TO_PARENT 18 #define OSERROR(X, S) do { if ((long)(X) == -1) { perror(S); exit(1); } } while(0) int main(int argc, char **argv) { key_serial_t keyring, key; long ret; keyring = keyctl_join_session_keyring(argv[1]); OSERROR(keyring, "keyctl_join_session_keyring"); key = add_key("user", "a", "b", 1, keyring); OSERROR(key, "add_key"); ret = keyctl(KEYCTL_SESSION_TO_PARENT); OSERROR(ret, "KEYCTL_SESSION_TO_PARENT"); return 0; } Compiled and linked with -lkeyutils, you should see something like: [dhowells@andromeda ~]$ keyctl show Session Keyring -3 --alswrv 4043 4043 keyring: _ses 355907932 --alswrv 4043 -1 \_ keyring: _uid.4043 [dhowells@andromeda ~]$ /tmp/newpag [dhowells@andromeda ~]$ keyctl show Session Keyring -3 --alswrv 4043 4043 keyring: _ses 1055658746 --alswrv 4043 4043 \_ user: a [dhowells@andromeda ~]$ /tmp/newpag hello [dhowells@andromeda ~]$ keyctl show Session Keyring -3 --alswrv 4043 4043 keyring: hello 340417692 --alswrv 4043 4043 \_ user: a Where the test program creates a new session keyring, sticks a user key named 'a' into it and then installs it on its parent. Signed-off-by: David Howells <[email protected]> Signed-off-by: James Morris <[email protected]>
PJ_DEF(pj_status_t) pjsua_start(void) { pj_status_t status; pjsua_set_state(PJSUA_STATE_STARTING); pj_log_push_indent(); status = pjsua_call_subsys_start(); if (status != PJ_SUCCESS) goto on_return; status = pjsua_media_subsys_start(); if (status != PJ_SUCCESS) goto on_return; status = pjsua_pres_start(); if (status != PJ_SUCCESS) goto on_return; pjsua_set_state(PJSUA_STATE_RUNNING); on_return: pj_log_pop_indent(); return status; }
0
[ "CWE-120", "CWE-787" ]
pjproject
d27f79da11df7bc8bb56c2f291d71e54df8d2c47
96,944,297,926,147,980,000,000,000,000,000,000,000
25
Use PJ_ASSERT_RETURN() on pjsip_auth_create_digest() and pjsua_init_tpselector() (#3009) * Use PJ_ASSERT_RETURN on pjsip_auth_create_digest * Use PJ_ASSERT_RETURN on pjsua_init_tpselector() * Fix incorrect check. * Add return value to pjsip_auth_create_digest() and pjsip_auth_create_digestSHA256() * Modification based on comments.
static int sctp_getsockopt_scheduler(struct sock *sk, int len, char __user *optval, int __user *optlen) { struct sctp_assoc_value params; struct sctp_association *asoc; int retval = -EFAULT; if (len < sizeof(params)) { retval = -EINVAL; goto out; } len = sizeof(params); if (copy_from_user(&params, optval, len)) goto out; asoc = sctp_id2assoc(sk, params.assoc_id); if (!asoc) { retval = -EINVAL; goto out; } params.assoc_value = sctp_sched_get_sched(asoc); if (put_user(len, optlen)) goto out; if (copy_to_user(optval, &params, len)) goto out; retval = 0; out: return retval; }
0
[ "CWE-416" ]
linux
a0ff660058b88d12625a783ce9e5c1371c87951f
160,998,410,518,430,920,000,000,000,000,000,000,000
36
sctp: return error if the asoc has been peeled off in sctp_wait_for_sndbuf After commit cea0cc80a677 ("sctp: use the right sk after waking up from wait_buf sleep"), it may change to lock another sk if the asoc has been peeled off in sctp_wait_for_sndbuf. However, the asoc's new sk could be already closed elsewhere, as it's in the sendmsg context of the old sk that can't avoid the new sk's closing. If the sk's last one refcnt is held by this asoc, later on after putting this asoc, the new sk will be freed, while under it's own lock. This patch is to revert that commit, but fix the old issue by returning error under the old sk's lock. Fixes: cea0cc80a677 ("sctp: use the right sk after waking up from wait_buf sleep") Reported-by: [email protected] Signed-off-by: Xin Long <[email protected]> Acked-by: Neil Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
bool kvm_inject_emulated_page_fault(struct kvm_vcpu *vcpu, struct x86_exception *fault) { struct kvm_mmu *fault_mmu; WARN_ON_ONCE(fault->vector != PF_VECTOR); fault_mmu = fault->nested_page_fault ? vcpu->arch.mmu : vcpu->arch.walk_mmu; /* * Invalidate the TLB entry for the faulting address, if it exists, * else the access will fault indefinitely (and to emulate hardware). */ if ((fault->error_code & PFERR_PRESENT_MASK) && !(fault->error_code & PFERR_RSVD_MASK)) kvm_mmu_invalidate_gva(vcpu, fault_mmu, fault->address, fault_mmu->root_hpa); fault_mmu->inject_page_fault(vcpu, fault); return fault->nested_page_fault; }
0
[ "CWE-476" ]
linux
55749769fe608fa3f4a075e42e89d237c8e37637
238,158,375,237,123,800,000,000,000,000,000,000,000
21
KVM: x86: Fix wall clock writes in Xen shared_info not to mark page dirty When dirty ring logging is enabled, any dirty logging without an active vCPU context will cause a kernel oops. But we've already declared that the shared_info page doesn't get dirty tracking anyway, since it would be kind of insane to mark it dirty every time we deliver an event channel interrupt. Userspace is supposed to just assume it's always dirty any time a vCPU can run or event channels are routed. So stop using the generic kvm_write_wall_clock() and just write directly through the gfn_to_pfn_cache that we already have set up. We can make kvm_write_wall_clock() static in x86.c again now, but let's not remove the 'sec_hi_ofs' argument even though it's not used yet. At some point we *will* want to use that for KVM guests too. Fixes: 629b5348841a ("KVM: x86/xen: update wallclock region") Reported-by: butt3rflyh4ck <[email protected]> Signed-off-by: David Woodhouse <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
bool arch_within_kprobe_blacklist(unsigned long addr) { return (addr >= (unsigned long)__kprobes_text_start && addr < (unsigned long)__kprobes_text_end) || (addr >= (unsigned long)__entry_text_start && addr < (unsigned long)__entry_text_end); }
0
[ "CWE-264" ]
linux
548acf19234dbda5a52d5a8e7e205af46e9da840
192,208,338,672,156,600,000,000,000,000,000,000,000
7
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]>
list_add_event(struct perf_event *event, struct perf_event_context *ctx) { WARN_ON_ONCE(event->attach_state & PERF_ATTACH_CONTEXT); event->attach_state |= PERF_ATTACH_CONTEXT; /* * If we're a stand alone event or group leader, we go to the context * list, group events are kept attached to the group so that * perf_group_detach can, at all times, locate all siblings. */ if (event->group_leader == event) { struct list_head *list; if (is_software_event(event)) event->group_flags |= PERF_GROUP_SOFTWARE; list = ctx_group_list(event, ctx); list_add_tail(&event->group_entry, list); } if (is_cgroup_event(event)) ctx->nr_cgroups++; list_add_rcu(&event->event_entry, &ctx->event_list); ctx->nr_events++; if (event->attr.inherit_stat) ctx->nr_stat++; ctx->generation++; }
0
[ "CWE-416", "CWE-362" ]
linux
12ca6ad2e3a896256f086497a7c7406a547ee373
171,616,506,070,548,800,000,000,000,000,000,000,000
30
perf: Fix race in swevent hash There's a race on CPU unplug where we free the swevent hash array while it can still have events on. This will result in a use-after-free which is BAD. Simply do not free the hash array on unplug. This leaves the thing around and no use-after-free takes place. When the last swevent dies, we do a for_each_possible_cpu() iteration anyway to clean these up, at which time we'll free it, so no leakage will occur. Reported-by: Sasha Levin <[email protected]> Tested-by: Sasha Levin <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
parser_process_expression_sequence (parser_context_t *context_p) /**< context */ { if (!CBC_NO_RESULT_OPERATION (context_p->last_cbc_opcode)) { parser_emit_cbc (context_p, CBC_POP); } if (context_p->stack_top_uint8 == LEXER_LEFT_PAREN) { parser_mem_page_t *page_p = context_p->stack.first_p; JERRY_ASSERT (page_p != NULL); page_p->bytes[context_p->stack.last_position - 1] = LEXER_COMMA_SEP_LIST; context_p->stack_top_uint8 = LEXER_COMMA_SEP_LIST; } lexer_next_token (context_p); } /* parser_process_expression_sequence */
0
[ "CWE-416" ]
jerryscript
3bcd48f72d4af01d1304b754ef19fe1a02c96049
69,672,026,285,003,820,000,000,000,000,000,000,000
19
Improve parse_identifier (#4691) Ascii string length is no longer computed during string allocation. JerryScript-DCO-1.0-Signed-off-by: Daniel Batiz [email protected]
void ConnectionImpl::onMessageCompleteBase() { ENVOY_CONN_LOG(trace, "message complete", connection_); if (handling_upgrade_) { // If this is an upgrade request, swallow the onMessageComplete. The // upgrade payload will be treated as stream body. ASSERT(!deferred_end_stream_headers_); ENVOY_CONN_LOG(trace, "Pausing parser due to upgrade.", connection_); http_parser_pause(&parser_, 1); return; } onMessageComplete(); }
0
[ "CWE-400", "CWE-703" ]
envoy
afc39bea36fd436e54262f150c009e8d72db5014
298,296,905,004,421,280,000,000,000,000,000,000,000
12
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]>
gdm_user_get_display_name (GdmUser *user) { g_return_val_if_fail (GDM_IS_USER (user), NULL); return (user->display_name ? user->display_name : gdm_user_get_real_name (user)); }
0
[]
gdm
c25ef9245be4e0be2126ef3d075df4401949b570
103,863,631,182,852,020,000,000,000,000,000,000,000
7
Store the face and dmrc files in a cache. Refer to bug #565151.
MagickExport PixelChannelMap *ClonePixelChannelMap(PixelChannelMap *channel_map) { PixelChannelMap *clone_map; assert(channel_map != (PixelChannelMap *) NULL); clone_map=AcquirePixelChannelMap(); if (clone_map == (PixelChannelMap *) NULL) return((PixelChannelMap *) NULL); (void) memcpy(clone_map,channel_map,MaxPixelChannels* sizeof(*channel_map)); return(clone_map); }
0
[ "CWE-190" ]
ImageMagick
406da3af9e09649cda152663c179902edf5ab3ac
139,293,522,230,908,030,000,000,000,000,000,000,000
13
https://github.com/ImageMagick/ImageMagick/issues/1732
cdataSectionProcessor(XML_Parser parser, const char *start, const char *end, const char **endPtr) { enum XML_Error result = doCdataSection(parser, parser->m_encoding, &start, end, endPtr, (XML_Bool)! parser->m_parsingStatus.finalBuffer); if (result != XML_ERROR_NONE) return result; if (start) { if (parser->m_parentParser) { /* we are parsing an external entity */ parser->m_processor = externalEntityContentProcessor; return externalEntityContentProcessor(parser, start, end, endPtr); } else { parser->m_processor = contentProcessor; return contentProcessor(parser, start, end, endPtr); } } return result; }
0
[ "CWE-611", "CWE-776", "CWE-415", "CWE-125" ]
libexpat
c20b758c332d9a13afbbb276d30db1d183a85d43
156,482,792,861,866,640,000,000,000,000,000,000,000
18
xmlparse.c: Deny internal entities closing the doctype
send_complete( struct net_local *nl ) { #ifdef CONFIG_SBNI_MULTILINE ((struct net_local *) nl->master->priv)->stats.tx_packets++; ((struct net_local *) nl->master->priv)->stats.tx_bytes += nl->tx_buf_p->len; #else nl->stats.tx_packets++; nl->stats.tx_bytes += nl->tx_buf_p->len; #endif dev_kfree_skb_irq( nl->tx_buf_p ); nl->tx_buf_p = NULL; nl->outpos = 0; nl->state &= ~(FL_WAIT_ACK | FL_NEED_RESEND); nl->framelen = 0; }
0
[ "CWE-264" ]
linux-2.6
f2455eb176ac87081bbfc9a44b21c7cd2bc1967e
51,832,587,408,821,350,000,000,000,000,000,000,000
18
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]>
messageAddStr(message *m, const char *data) { line_t *repeat = NULL; assert(m != NULL); if(data) { if(*data == '\0') data = NULL; else { /* * If it's only white space, just store one space to * save memory. You must store something since it may * be a header line */ int iswhite = 1; const char *p; for(p = data; *p; p++) if(((*p) & 0x80) || !isspace(*p)) { iswhite = 0; break; } if(iswhite) { /*cli_dbgmsg("messageAddStr: empty line: '%s'\n", data);*/ data = " "; } } } if(m->body_first == NULL) m->body_last = m->body_first = (text *)cli_malloc(sizeof(text)); else { assert(m->body_last != NULL); if((data == NULL) && (m->body_last->t_line == NULL)) /* * Although this would save time and RAM, some * phish signatures have been built which need the * blank lines */ if(messageGetMimeType(m) != TEXT) /* don't save two blank lines in sucession */ return 1; m->body_last->t_next = (text *)cli_malloc(sizeof(text)); if(m->body_last->t_next == NULL) { messageDedup(m); m->body_last->t_next = (text *)cli_malloc(sizeof(text)); if(m->body_last->t_next == NULL) { cli_errmsg("messageAddStr: out of memory\n"); return -1; } } if(data && m->body_last->t_line && (strcmp(data, lineGetData(m->body_last->t_line)) == 0)) repeat = m->body_last->t_line; m->body_last = m->body_last->t_next; } if(m->body_last == NULL) { cli_errmsg("messageAddStr: out of memory\n"); return -1; } m->body_last->t_next = NULL; if(data && *data) { if(repeat) m->body_last->t_line = lineLink(repeat); else { m->body_last->t_line = lineCreate(data); if(m->body_last->t_line == NULL) { messageDedup(m); m->body_last->t_line = lineCreate(data); if(m->body_last->t_line == NULL) { cli_errmsg("messageAddStr: out of memory\n"); return -1; } } /* cli_chomp(m->body_last->t_text); */ messageIsEncoding(m); } } else m->body_last->t_line = NULL; return 1; }
0
[ "CWE-125" ]
clamav-devel
586a5180287262070637c8943f2f7efd652e4a2c
72,703,532,932,222,470,000,000,000,000,000,000,000
89
bb11797 - fix invalid read in fuzzed mail file.
enum precedence precedence() const { return ref ? (*ref)->precedence() : DEFAULT_PRECEDENCE; }
0
[ "CWE-617" ]
server
2e7891080667c59ac80f788eef4d59d447595772
326,267,646,280,748,450,000,000,000,000,000,000,000
4
MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view This bug could manifest itself after pushing a where condition over a mergeable derived table / view / CTE DT into a grouping view / derived table / CTE V whose item list contained set functions with constant arguments such as MIN(2), SUM(1) etc. In such cases the field references used in the condition pushed into the view V that correspond set functions are wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation of the virtual method const_item() for the class Item_direct_view_ref the wrapped set functions with constant arguments could be erroneously taken for constant items. This could lead to a wrong result set returned by the main select query in 10.2. In 10.4 where a possibility of pushing condition from HAVING into WHERE had been added this could cause a crash. Approved by Sergey Petrunya <[email protected]>
static int WSAGetLastError() { return errno; }
0
[ "CWE-476" ]
exiv2
ccde30afa8ca787a3fe17388a15977f107a53b72
273,820,469,772,865,660,000,000,000,000,000,000,000
4
Avoid null pointer exception due to NULL return value from strchr. This fixes #793. (cherry picked from commit ae20c30805b330275b2aa0303a42e1f2bbd53661)
static unsigned readChunk_pHYs(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) { if(chunkLength != 9) return 74; /*invalid pHYs chunk size*/ info->phys_defined = 1; info->phys_x = 16777216u * data[0] + 65536u * data[1] + 256u * data[2] + data[3]; info->phys_y = 16777216u * data[4] + 65536u * data[5] + 256u * data[6] + data[7]; info->phys_unit = data[8]; return 0; /* OK */ }
0
[ "CWE-401" ]
FreeRDP
9fee4ae076b1ec97b97efb79ece08d1dab4df29a
328,154,495,687,569,920,000,000,000,000,000,000,000
11
Fixed #5645: realloc return handling
rotate_point(GdkPoint point, double angle) { double sint, cost; GdkPoint returned; if (angle == 0.0) return point; sint = sin(DEG2RAD(-angle)); cost = cos(DEG2RAD(-angle)); returned.x = lround(cost*point.x - sint*point.y); returned.y = lround(sint*point.x + cost*point.y); return returned; }
0
[ "CWE-703" ]
gerbv
b2c2f8da851f2ac8079a91ce9d498d87ff96abcf
247,439,282,890,700,340,000,000,000,000,000,000,000
16
Avoid direct access on array of unknown size Be requiring a `gerbv_simplified_amacro_t` the `dgk_draw_amacro_funcs` can be sure of the length of the parameter array.
static int encode_lookup(struct xdr_stream *xdr, const struct qstr *name) { int len = name->len; __be32 *p; RESERVE_SPACE(8 + len); WRITE32(OP_LOOKUP); WRITE32(len); WRITEMEM(name->name, len); return 0; }
0
[ "CWE-703" ]
linux
dc0b027dfadfcb8a5504f7d8052754bf8d501ab9
108,463,408,565,326,420,000,000,000,000,000,000,000
12
NFSv4: Convert the open and close ops to use fmode Signed-off-by: Trond Myklebust <[email protected]>
int af_alg_cmsg_send(struct msghdr *msg, struct af_alg_control *con) { struct cmsghdr *cmsg; for_each_cmsghdr(cmsg, msg) { if (!CMSG_OK(msg, cmsg)) return -EINVAL; if (cmsg->cmsg_level != SOL_ALG) continue; switch (cmsg->cmsg_type) { case ALG_SET_IV: if (cmsg->cmsg_len < CMSG_LEN(sizeof(*con->iv))) return -EINVAL; con->iv = (void *)CMSG_DATA(cmsg); if (cmsg->cmsg_len < CMSG_LEN(con->iv->ivlen + sizeof(*con->iv))) return -EINVAL; break; case ALG_SET_OP: if (cmsg->cmsg_len < CMSG_LEN(sizeof(u32))) return -EINVAL; con->op = *(u32 *)CMSG_DATA(cmsg); break; case ALG_SET_AEAD_ASSOCLEN: if (cmsg->cmsg_len < CMSG_LEN(sizeof(u32))) return -EINVAL; con->aead_assoclen = *(u32 *)CMSG_DATA(cmsg); break; default: return -EINVAL; } } return 0; }
0
[ "CWE-416" ]
linux
9060cb719e61b685ec0102574e10337fa5f445ea
259,921,699,831,096,120,000,000,000,000,000,000,000
39
net: crypto set sk to NULL when af_alg_release. KASAN has found use-after-free in sockfs_setattr. The existed commit 6d8c50dcb029 ("socket: close race condition between sock_close() and sockfs_setattr()") is to fix this simillar issue, but it seems to ignore that crypto module forgets to set the sk to NULL after af_alg_release. KASAN report details as below: BUG: KASAN: use-after-free in sockfs_setattr+0x120/0x150 Write of size 4 at addr ffff88837b956128 by task syz-executor0/4186 CPU: 2 PID: 4186 Comm: syz-executor0 Not tainted xxx + #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 Call Trace: dump_stack+0xca/0x13e print_address_description+0x79/0x330 ? vprintk_func+0x5e/0xf0 kasan_report+0x18a/0x2e0 ? sockfs_setattr+0x120/0x150 sockfs_setattr+0x120/0x150 ? sock_register+0x2d0/0x2d0 notify_change+0x90c/0xd40 ? chown_common+0x2ef/0x510 chown_common+0x2ef/0x510 ? chmod_common+0x3b0/0x3b0 ? __lock_is_held+0xbc/0x160 ? __sb_start_write+0x13d/0x2b0 ? __mnt_want_write+0x19a/0x250 do_fchownat+0x15c/0x190 ? __ia32_sys_chmod+0x80/0x80 ? trace_hardirqs_on_thunk+0x1a/0x1c __x64_sys_fchownat+0xbf/0x160 ? lockdep_hardirqs_on+0x39a/0x5e0 do_syscall_64+0xc8/0x580 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x462589 Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fb4b2c83c58 EFLAGS: 00000246 ORIG_RAX: 0000000000000104 RAX: ffffffffffffffda RBX: 000000000072bfa0 RCX: 0000000000462589 RDX: 0000000000000000 RSI: 00000000200000c0 RDI: 0000000000000007 RBP: 0000000000000005 R08: 0000000000001000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fb4b2c846bc R13: 00000000004bc733 R14: 00000000006f5138 R15: 00000000ffffffff Allocated by task 4185: kasan_kmalloc+0xa0/0xd0 __kmalloc+0x14a/0x350 sk_prot_alloc+0xf6/0x290 sk_alloc+0x3d/0xc00 af_alg_accept+0x9e/0x670 hash_accept+0x4a3/0x650 __sys_accept4+0x306/0x5c0 __x64_sys_accept4+0x98/0x100 do_syscall_64+0xc8/0x580 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 4184: __kasan_slab_free+0x12e/0x180 kfree+0xeb/0x2f0 __sk_destruct+0x4e6/0x6a0 sk_destruct+0x48/0x70 __sk_free+0xa9/0x270 sk_free+0x2a/0x30 af_alg_release+0x5c/0x70 __sock_release+0xd3/0x280 sock_close+0x1a/0x20 __fput+0x27f/0x7f0 task_work_run+0x136/0x1b0 exit_to_usermode_loop+0x1a7/0x1d0 do_syscall_64+0x461/0x580 entry_SYSCALL_64_after_hwframe+0x49/0xbe Syzkaller reproducer: r0 = perf_event_open(&(0x7f0000000000)={0x0, 0x70, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, @perf_config_ext}, 0x0, 0x0, 0xffffffffffffffff, 0x0) r1 = socket$alg(0x26, 0x5, 0x0) getrusage(0x0, 0x0) bind(r1, &(0x7f00000001c0)=@alg={0x26, 'hash\x00', 0x0, 0x0, 'sha256-ssse3\x00'}, 0x80) r2 = accept(r1, 0x0, 0x0) r3 = accept4$unix(r2, 0x0, 0x0, 0x0) r4 = dup3(r3, r0, 0x0) fchownat(r4, &(0x7f00000000c0)='\x00', 0x0, 0x0, 0x1000) Fixes: 6d8c50dcb029 ("socket: close race condition between sock_close() and sockfs_setattr()") Signed-off-by: Mao Wenan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, int node) { pg_data_t *pgdat = NODE_DATA(node); int isolated; int nr_remaining; LIST_HEAD(migratepages); /* * Don't migrate file pages that are mapped in multiple processes * with execute permissions as they are probably shared libraries. */ if (page_mapcount(page) != 1 && page_is_file_cache(page) && (vma->vm_flags & VM_EXEC)) goto out; /* * Rate-limit the amount of data that is being migrated to a node. * Optimal placement is no good if the memory bus is saturated and * all the time is being spent migrating! */ if (numamigrate_update_ratelimit(pgdat, 1)) goto out; isolated = numamigrate_isolate_page(pgdat, page); if (!isolated) goto out; list_add(&page->lru, &migratepages); nr_remaining = migrate_pages(&migratepages, alloc_misplaced_dst_page, NULL, node, MIGRATE_ASYNC, MR_NUMA_MISPLACED); if (nr_remaining) { if (!list_empty(&migratepages)) { list_del(&page->lru); dec_zone_page_state(page, NR_ISOLATED_ANON + page_is_file_cache(page)); putback_lru_page(page); } isolated = 0; } else count_vm_numa_event(NUMA_PAGE_MIGRATE); BUG_ON(!list_empty(&migratepages)); return isolated; out: put_page(page); return 0; }
0
[ "CWE-476" ]
linux
42cb14b110a5698ccf26ce59c4441722605a3743
327,136,195,577,177,900,000,000,000,000,000,000,000
49
mm: migrate dirty page without clear_page_dirty_for_io etc clear_page_dirty_for_io() has accumulated writeback and memcg subtleties since v2.6.16 first introduced page migration; and the set_page_dirty() which completed its migration of PageDirty, later had to be moderated to __set_page_dirty_nobuffers(); then PageSwapBacked had to skip that too. No actual problems seen with this procedure recently, but if you look into what the clear_page_dirty_for_io(page)+set_page_dirty(newpage) is actually achieving, it turns out to be nothing more than moving the PageDirty flag, and its NR_FILE_DIRTY stat from one zone to another. It would be good to avoid a pile of irrelevant decrementations and incrementations, and improper event counting, and unnecessary descent of the radix_tree under tree_lock (to set the PAGECACHE_TAG_DIRTY which radix_tree_replace_slot() left in place anyway). Do the NR_FILE_DIRTY movement, like the other stats movements, while interrupts still disabled in migrate_page_move_mapping(); and don't even bother if the zone is the same. Do the PageDirty movement there under tree_lock too, where old page is frozen and newpage not yet visible: bearing in mind that as soon as newpage becomes visible in radix_tree, an un-page-locked set_page_dirty() might interfere (or perhaps that's just not possible: anything doing so should already hold an additional reference to the old page, preventing its migration; but play safe). But we do still need to transfer PageDirty in migrate_page_copy(), for those who don't go the mapping route through migrate_page_move_mapping(). Signed-off-by: Hugh Dickins <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Davidlohr Bueso <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Sasha Levin <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: KOSAKI Motohiro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
ceph::bufferlist AES128GCM_OnWireRxHandler::authenticated_decrypt_update_final( ceph::bufferlist&& ciphertext_and_tag, std::uint32_t alignment) { const auto cnt_len = ciphertext_and_tag.length(); ceph_assert(cnt_len >= AESGCM_TAG_LEN); // decrypt optional data. Caller is obliged to provide only signature but it // may supply ciphertext as well. Combining the update + final is reflected // combined together. ceph::bufferlist plainbl; ceph::bufferlist auth_tag; { const auto tag_off = cnt_len - AESGCM_TAG_LEN; ceph::bufferlist ciphertext; ciphertext_and_tag.splice(0, tag_off, &ciphertext); // the rest is the signature (a.k.a auth tag) auth_tag = std::move(ciphertext_and_tag); if (ciphertext.length()) { plainbl = authenticated_decrypt_update(std::move(ciphertext), alignment); } } // we need to ensure the tag is stored in continuous memory. if (1 != EVP_CIPHER_CTX_ctrl(ectx.get(), EVP_CTRL_GCM_SET_TAG, AESGCM_TAG_LEN, auth_tag.c_str())) { throw std::runtime_error("EVP_CIPHER_CTX_ctrl failed"); } // I expect that 0 bytes will be appended. The call is supposed solely to // authenticate the message. { int final_len = 0; if (0 >= EVP_DecryptFinal_ex(ectx.get(), nullptr, &final_len)) { ldout(cct, 15) << __func__ << " plainbl.length()=" << plainbl.length() << " final_len=" << final_len << dendl; throw MsgAuthError(); } else { ceph_assert_always(final_len == 0); ceph_assert_always(plainbl.length() + final_len + AESGCM_TAG_LEN == cnt_len); } } return plainbl; }
0
[ "CWE-323" ]
ceph
20b7bb685c5ea74c651ca1ea547ac66b0fee7035
278,328,570,821,652,830,000,000,000,000,000,000,000
49
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 inline LineContribType *_gdContributionsCalc(unsigned int line_size, unsigned int src_size, double scale_d, const interpolation_method pFilter) { double width_d; double scale_f_d = 1.0; const double filter_width_d = DEFAULT_BOX_RADIUS; int windows_size; unsigned int u; LineContribType *res; int overflow_error = 0; if (scale_d < 1.0) { width_d = filter_width_d / scale_d; scale_f_d = scale_d; } else { width_d= filter_width_d; } windows_size = 2 * (int)ceil(width_d) + 1; res = _gdContributionsAlloc(line_size, windows_size); if (res == NULL) { return NULL; } for (u = 0; u < line_size; u++) { const double dCenter = (double)u / scale_d; /* get the significant edge points affecting the pixel */ register int iLeft = MAX(0, (int)floor (dCenter - width_d)); int iRight = MIN((int)ceil(dCenter + width_d), (int)src_size - 1); double dTotalWeight = 0.0; int iSrc; /* Cut edge points to fit in filter window in case of spill-off */ if (iRight - iLeft + 1 > windows_size) { if (iLeft < ((int)src_size - 1 / 2)) { iLeft++; } else { iRight--; } } res->ContribRow[u].Left = iLeft; res->ContribRow[u].Right = iRight; for (iSrc = iLeft; iSrc <= iRight; iSrc++) { dTotalWeight += (res->ContribRow[u].Weights[iSrc-iLeft] = scale_f_d * (*pFilter)(scale_f_d * (dCenter - (double)iSrc))); } if (dTotalWeight < 0.0) { _gdContributionsFree(res); return NULL; } if (dTotalWeight > 0.0) { for (iSrc = iLeft; iSrc <= iRight; iSrc++) { res->ContribRow[u].Weights[iSrc-iLeft] /= dTotalWeight; } } } return res; }
0
[ "CWE-119" ]
php-src
8fa9d1ce28f3a894b104979df30d0b65e0f21107
203,443,726,186,405,240,000,000,000,000,000,000,000
59
improve fix #72558, while (u>=0) with unsigned int will always be true
bool CephXTicketHandler::have_key() { if (have_key_flag) { have_key_flag = ceph_clock_now() < expires; } return have_key_flag; }
0
[ "CWE-287", "CWE-284" ]
ceph
5ead97120e07054d80623dada90a5cc764c28468
71,866,966,340,028,160,000,000,000,000,000,000,000
8
auth/cephx: add authorizer challenge Allow the accepting side of a connection to reject an initial authorizer with a random challenge. The connecting side then has to respond with an updated authorizer proving they are able to decrypt the service's challenge and that the new authorizer was produced for this specific connection instance. The accepting side requires this challenge and response unconditionally if the client side advertises they have the feature bit. Servers wishing to require this improved level of authentication simply have to require the appropriate feature. Signed-off-by: Sage Weil <[email protected]> (cherry picked from commit f80b848d3f830eb6dba50123e04385173fa4540b) # Conflicts: # src/auth/Auth.h # src/auth/cephx/CephxProtocol.cc # src/auth/cephx/CephxProtocol.h # src/auth/none/AuthNoneProtocol.h # src/msg/Dispatcher.h # src/msg/async/AsyncConnection.cc - const_iterator - ::decode vs decode - AsyncConnection ctor arg noise - get_random_bytes(), not cct->random()
BYTE* crypto_cert_hash(X509* xcert, const char* hash, UINT32* length) { UINT32 fp_len = EVP_MAX_MD_SIZE; BYTE* fp; const EVP_MD* md = EVP_get_digestbyname(hash); if (!md) return NULL; if (!length) return NULL; if (!xcert) return NULL; fp = calloc(fp_len, sizeof(BYTE)); if (!fp) return NULL; if (X509_digest(xcert, md, fp, &fp_len) != 1) { free(fp); return NULL; } *length = fp_len; return fp; }
0
[ "CWE-787" ]
FreeRDP
8305349a943c68b1bc8c158f431dc607655aadea
258,407,869,867,369,750,000,000,000,000,000,000,000
25
Fixed GHSL-2020-102 heap overflow (cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)
static int test_gf2m_moddiv(void) { BIGNUM *a = NULL, *b[2] = {NULL, NULL}, *c = NULL, *d = NULL; BIGNUM *e = NULL, *f = NULL; int i, j, st = 0; if (!TEST_ptr(a = BN_new()) || !TEST_ptr(b[0] = BN_new()) || !TEST_ptr(b[1] = BN_new()) || !TEST_ptr(c = BN_new()) || !TEST_ptr(d = BN_new()) || !TEST_ptr(e = BN_new()) || !TEST_ptr(f = BN_new())) goto err; if (!(TEST_true(BN_GF2m_arr2poly(p0, b[0])) && TEST_true(BN_GF2m_arr2poly(p1, b[1])))) goto err; for (i = 0; i < NUM0; i++) { if (!(TEST_true(BN_bntest_rand(a, 512, 0, 0)) && TEST_true(BN_bntest_rand(c, 512, 0, 0)))) goto err; for (j = 0; j < 2; j++) { if (!(TEST_true(BN_GF2m_mod_div(d, a, c, b[j], ctx)) && TEST_true(BN_GF2m_mod_mul(e, d, c, b[j], ctx)) && TEST_true(BN_GF2m_mod_div(f, a, e, b[j], ctx)) /* Test that ((a/c)*c)/a = 1. */ && TEST_BN_eq_one(f))) goto err; } } st = 1; err: BN_free(a); BN_free(b[0]); BN_free(b[1]); BN_free(c); BN_free(d); BN_free(e); BN_free(f); return st; }
0
[]
openssl
336923c0c8d705cb8af5216b29a205662db0d590
158,965,173,593,664,700,000,000,000,000,000,000,000
43
Fix a carry overflow bug in bn_sqr_comba4/8 for mips 32-bit targets bn_sqr_comba8 does for instance compute a wrong result for the value: a=0x4aaac919 62056c84 fba7334e 1a6be678 022181ba fd3aa878 899b2346 ee210f45 The correct result is: r=0x15c72e32 605a3061 d11b1012 3c187483 6df96999 bd0c22ba d3e7d437 4724a82f 912c5e61 6a187efe 8f7c47fc f6945fe5 75be8e3d 97ed17d4 7950b465 3cb32899 but the actual result was: r=0x15c72e32 605a3061 d11b1012 3c187483 6df96999 bd0c22ba d3e7d437 4724a82f 912c5e61 6a187efe 8f7c47fc f6945fe5 75be8e3c 97ed17d4 7950b465 3cb32899 so the forth word of the result was 0x75be8e3c but should have been 0x75be8e3d instead. Likewise bn_sqr_comba4 has an identical bug for the same value as well: a=0x022181ba fd3aa878 899b2346 ee210f45 correct result: r=0x00048a69 9fe82f8b 62bd2ed1 88781335 75be8e3d 97ed17d4 7950b465 3cb32899 wrong result: r=0x00048a69 9fe82f8b 62bd2ed1 88781335 75be8e3c 97ed17d4 7950b465 3cb32899 Fortunately the bn_mul_comba4/8 code paths are not affected. Also the mips64 target does in fact not handle the carry propagation correctly. Example: a=0x4aaac91900000000 62056c8400000000 fba7334e00000000 1a6be67800000000 022181ba00000000 fd3aa87800000000 899b234635dad283 ee210f4500000001 correct result: r=0x15c72e32272c4471 392debf018c679c8 b85496496bf8254c d0204f36611e2be1 0cdb3db8f3c081d8 c94ba0e1bacc5061 191b83d47ff929f6 5be0aebfc13ae68d 3eea7a7fdf2f5758 42f7ec656cab3cb5 6a28095be34756f2 64f24687bf37de06 2822309cd1d292f9 6fa698c972372f09 771e97d3a868cda0 dc421e8a00000001 wrong result: r=0x15c72e32272c4471 392debf018c679c8 b85496496bf8254c d0204f36611e2be1 0cdb3db8f3c081d8 c94ba0e1bacc5061 191b83d47ff929f6 5be0aebfc13ae68d 3eea7a7fdf2f5758 42f7ec656cab3cb5 6a28095be34756f2 64f24687bf37de06 2822309cd1d292f8 6fa698c972372f09 771e97d3a868cda0 dc421e8a00000001 Reviewed-by: Paul Dale <[email protected]> (Merged from https://github.com/openssl/openssl/pull/17258)
void blk_put_queue(struct request_queue *q) { kobject_put(&q->kobj); }
0
[ "CWE-416", "CWE-703" ]
linux
54648cf1ec2d7f4b6a71767799c45676a138ca24
52,278,555,164,697,990,000,000,000,000,000,000,000
4
block: blk_init_allocated_queue() set q->fq as NULL in the fail case We find the memory use-after-free issue in __blk_drain_queue() on the kernel 4.14. After read the latest kernel 4.18-rc6 we think it has the same problem. Memory is allocated for q->fq in the blk_init_allocated_queue(). If the elevator init function called with error return, it will run into the fail case to free the q->fq. Then the __blk_drain_queue() uses the same memory after the free of the q->fq, it will lead to the unpredictable event. The patch is to set q->fq as NULL in the fail case of blk_init_allocated_queue(). Fixes: commit 7c94e1c157a2 ("block: introduce blk_flush_queue to drive flush machinery") Cc: <[email protected]> Reviewed-by: Ming Lei <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: xiao jin <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
register_on_commit_action(Oid relid, OnCommitAction action) { OnCommitItem *oc; MemoryContext oldcxt; /* * We needn't bother registering the relation unless there is an ON COMMIT * action we need to take. */ if (action == ONCOMMIT_NOOP || action == ONCOMMIT_PRESERVE_ROWS) return; oldcxt = MemoryContextSwitchTo(CacheMemoryContext); oc = (OnCommitItem *) palloc(sizeof(OnCommitItem)); oc->relid = relid; oc->oncommit = action; oc->creating_subid = GetCurrentSubTransactionId(); oc->deleting_subid = InvalidSubTransactionId; on_commits = lcons(oc, on_commits); MemoryContextSwitchTo(oldcxt); }
0
[ "CWE-362" ]
postgres
5f173040e324f6c2eebb90d86cf1b0cdb5890f0a
96,894,476,482,547,500,000,000,000,000,000,000,000
24
Avoid repeated name lookups during table and index DDL. If the name lookups come to different conclusions due to concurrent activity, we might perform some parts of the DDL on a different table than other parts. At least in the case of CREATE INDEX, this can be used to cause the permissions checks to be performed against a different table than the index creation, allowing for a privilege escalation attack. This changes the calling convention for DefineIndex, CreateTrigger, transformIndexStmt, transformAlterTableStmt, CheckIndexCompatible (in 9.2 and newer), and AlterTable (in 9.1 and older). In addition, CheckRelationOwnership is removed in 9.2 and newer and the calling convention is changed in older branches. A field has also been added to the Constraint node (FkConstraint in 8.4). Third-party code calling these functions or using the Constraint node will require updating. Report by Andres Freund. Patch by Robert Haas and Andres Freund, reviewed by Tom Lane. Security: CVE-2014-0062
static const char *parse_interpreter(const char *cmd) { static char buf[100]; char *p, *opt; int n, fd; /* don't even try a .exe */ n = strlen(cmd); if (n >= 4 && !strcasecmp(cmd+n-4, ".exe")) return NULL; fd = open(cmd, O_RDONLY); if (fd < 0) return NULL; n = read(fd, buf, sizeof(buf)-1); close(fd); if (n < 4) /* at least '#!/x' and not error */ return NULL; if (buf[0] != '#' || buf[1] != '!') return NULL; buf[n] = '\0'; p = buf + strcspn(buf, "\r\n"); if (!*p) return NULL; *p = '\0'; if (!(p = strrchr(buf+2, '/')) && !(p = strrchr(buf+2, '\\'))) return NULL; /* strip options */ if ((opt = strchr(p+1, ' '))) *opt = '\0'; return p+1; }
0
[ "CWE-20" ]
git
6d8684161ee9c03bed5cb69ae76dfdddb85a0003
50,555,701,919,846,960,000,000,000,000,000,000,000
34
mingw: fix quoting of arguments We need to be careful to follow proper quoting rules. For example, if an argument contains spaces, we have to quote them. Double-quotes need to be escaped. Backslashes need to be escaped, but only if they are followed by a double-quote character. We need to be _extra_ careful to consider the case where an argument ends in a backslash _and_ needs to be quoted: in this case, we append a double-quote character, i.e. the backslash now has to be escaped! The current code, however, fails to recognize that, and therefore can turn an argument that ends in a single backslash into a quoted argument that now ends in an escaped double-quote character. This allows subsequent command-line parameters to be split and part of them being mistaken for command-line options, e.g. through a maliciously-crafted submodule URL during a recursive clone. Technically, we would not need to quote _all_ arguments which end in a backslash _unless_ the argument needs to be quoted anyway. For example, `test\` would not need to be quoted, while `test \` would need to be. To keep the code simple, however, and therefore easier to reason about and ensure its correctness, we now _always_ quote an argument that ends in a backslash. This addresses CVE-2019-1350. Signed-off-by: Johannes Schindelin <[email protected]>
void sequencer_unload(void) { vfree(queue); vfree(iqueue); queue = iqueue = NULL; }
0
[ "CWE-703", "CWE-189" ]
linux
b769f49463711205d57286e64cf535ed4daf59e9
232,640,367,932,837,870,000,000,000,000,000,000,000
6
sound/oss: remove offset from load_patch callbacks Was: [PATCH] sound/oss/midi_synth: prevent underflow, use of uninitialized value, and signedness issue The offset passed to midi_synth_load_patch() can be essentially arbitrary. If it's greater than the header length, this will result in a copy_from_user(dst, src, negative_val). While this will just return -EFAULT on x86, on other architectures this may cause memory corruption. Additionally, the length field of the sysex_info structure may not be initialized prior to its use. Finally, a signed comparison may result in an unintentionally large loop. On suggestion by Takashi Iwai, version two removes the offset argument from the load_patch callbacks entirely, which also resolves similar issues in opl3. Compile tested only. v3 adjusts comments and hopefully gets copy offsets right. Signed-off-by: Dan Rosenberg <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
convert_indexed_contact_property_to_updatexml_physical_address (ESoapMessage *message, const gchar *name, const gchar *uri_element, const gchar *value, const gchar *prefix, const gchar *element_name, const gchar *key) { gchar * fielduri = NULL; gboolean delete_field = FALSE; if (!value || g_strcmp0 (value, "") == 0) delete_field = TRUE; fielduri = g_strconcat (name, ":", uri_element, NULL); e_ews_message_start_set_indexed_item_field (message, fielduri , prefix, "Contact", key, delete_field); if (!delete_field) { e_soap_message_start_element (message, element_name, NULL, NULL); e_soap_message_start_element (message, "Entry", NULL, NULL); e_soap_message_add_attribute (message, "Key", key, NULL, NULL); e_ews_message_write_string_parameter (message, uri_element, NULL, value); e_soap_message_end_element (message); e_soap_message_end_element (message); } e_ews_message_end_set_indexed_item_field (message, delete_field); }
0
[ "CWE-295" ]
evolution-ews
915226eca9454b8b3e5adb6f2fff9698451778de
315,364,937,146,235,770,000,000,000,000,000,000,000
31
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
placeholder *clone() const override { return new holder(value_); }
0
[ "CWE-125" ]
cpp-peglib
b3b29ce8f3acf3a32733d930105a17d7b0ba347e
292,195,762,183,302,000,000,000,000,000,000,000,000
1
Fix #122
virDomainLeaseDefFormat(virBufferPtr buf, virDomainLeaseDefPtr def) { virBufferAddLit(buf, "<lease>\n"); virBufferAdjustIndent(buf, 2); virBufferEscapeString(buf, "<lockspace>%s</lockspace>\n", def->lockspace); virBufferEscapeString(buf, "<key>%s</key>\n", def->key); virBufferEscapeString(buf, "<target path='%s'", def->path); if (def->offset) virBufferAsprintf(buf, " offset='%llu'", def->offset); virBufferAddLit(buf, "/>\n"); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "</lease>\n"); return 0; }
0
[ "CWE-212" ]
libvirt
a5b064bf4b17a9884d7d361733737fb614ad8979
272,623,553,598,174,000,000,000,000,000,000,000,000
16
conf: Don't format http cookies unless VIR_DOMAIN_DEF_FORMAT_SECURE is used Starting with 3b076391befc3fe72deb0c244ac6c2b4c100b410 (v6.1.0-122-g3b076391be) we support http cookies. Since they may contain somewhat sensitive information we should not format them into the XML unless VIR_DOMAIN_DEF_FORMAT_SECURE is asserted. Reported-by: Han Han <[email protected]> Signed-off-by: Peter Krempa <[email protected]> Reviewed-by: Erik Skultety <[email protected]>
static inline void rb_event_discard(struct ring_buffer_event *event) { if (event->type_len == RINGBUF_TYPE_TIME_EXTEND) event = skip_time_extend(event); /* array[0] holds the actual length for the discarded event */ event->array[0] = rb_event_data_length(event) - RB_EVNT_HDR_SIZE; event->type_len = RINGBUF_TYPE_PADDING; /* time delta must be non zero */ if (!event->time_delta) event->time_delta = 1; }
0
[ "CWE-190" ]
linux-stable
59643d1535eb220668692a5359de22545af579f6
27,979,474,758,607,320,000,000,000,000,000,000,000
12
ring-buffer: Prevent overflow of size in ring_buffer_resize() If the size passed to ring_buffer_resize() is greater than MAX_LONG - BUF_PAGE_SIZE then the DIV_ROUND_UP() will return zero. Here's the details: # echo 18014398509481980 > /sys/kernel/debug/tracing/buffer_size_kb tracing_entries_write() processes this and converts kb to bytes. 18014398509481980 << 10 = 18446744073709547520 and this is passed to ring_buffer_resize() as unsigned long size. size = DIV_ROUND_UP(size, BUF_PAGE_SIZE); Where DIV_ROUND_UP(a, b) is (a + b - 1)/b BUF_PAGE_SIZE is 4080 and here 18446744073709547520 + 4080 - 1 = 18446744073709551599 where 18446744073709551599 is still smaller than 2^64 2^64 - 18446744073709551599 = 17 But now 18446744073709551599 / 4080 = 4521260802379792 and size = size * 4080 = 18446744073709551360 This is checked to make sure its still greater than 2 * 4080, which it is. Then we convert to the number of buffer pages needed. nr_page = DIV_ROUND_UP(size, BUF_PAGE_SIZE) but this time size is 18446744073709551360 and 2^64 - (18446744073709551360 + 4080 - 1) = -3823 Thus it overflows and the resulting number is less than 4080, which makes 3823 / 4080 = 0 an nr_pages is set to this. As we already checked against the minimum that nr_pages may be, this causes the logic to fail as well, and we crash the kernel. There's no reason to have the two DIV_ROUND_UP() (that's just result of historical code changes), clean up the code and fix this bug. Cc: [email protected] # 3.5+ Fixes: 83f40318dab00 ("ring-buffer: Make removal of ring buffer pages atomic") Signed-off-by: Steven Rostedt <[email protected]>
apr_status_t h2_beam_destroy(h2_bucket_beam *beam) { apr_pool_cleanup_kill(beam->pool, beam, beam_pool_cleanup); return beam_cleanup(beam, 0); }
0
[ "CWE-400" ]
mod_h2
83a2e3866918ce6567a683eb4c660688d047ee81
203,723,433,533,381,840,000,000,000,000,000,000,000
5
* fixes a race condition where aborting streams triggers an unnecessary timeout.
static int snd_seq_ioctl_unsubscribe_port(struct snd_seq_client *client, void *arg) { struct snd_seq_port_subscribe *subs = arg; int result = -ENXIO; struct snd_seq_client *receiver = NULL, *sender = NULL; struct snd_seq_client_port *sport = NULL, *dport = NULL; if ((receiver = snd_seq_client_use_ptr(subs->dest.client)) == NULL) goto __end; if ((sender = snd_seq_client_use_ptr(subs->sender.client)) == NULL) goto __end; if ((sport = snd_seq_port_use_ptr(sender, subs->sender.port)) == NULL) goto __end; if ((dport = snd_seq_port_use_ptr(receiver, subs->dest.port)) == NULL) goto __end; result = check_subscription_permission(client, sport, dport, subs); if (result < 0) goto __end; result = snd_seq_port_disconnect(client, sender, sport, receiver, dport, subs); if (! result) /* broadcast announce */ snd_seq_client_notify_subscription(SNDRV_SEQ_ADDRESS_SUBSCRIBERS, 0, subs, SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED); __end: if (sport) snd_seq_port_unlock(sport); if (dport) snd_seq_port_unlock(dport); if (sender) snd_seq_client_unlock(sender); if (receiver) snd_seq_client_unlock(receiver); return result; }
0
[ "CWE-416", "CWE-362" ]
linux
71105998845fb012937332fe2e806d443c09e026
178,260,939,929,583,600,000,000,000,000,000,000,000
36
ALSA: seq: Fix use-after-free at creating a port There is a potential race window opened at creating and deleting a port via ioctl, as spotted by fuzzing. snd_seq_create_port() creates a port object and returns its pointer, but it doesn't take the refcount, thus it can be deleted immediately by another thread. Meanwhile, snd_seq_ioctl_create_port() still calls the function snd_seq_system_client_ev_port_start() with the created port object that is being deleted, and this triggers use-after-free like: BUG: KASAN: use-after-free in snd_seq_ioctl_create_port+0x504/0x630 [snd_seq] at addr ffff8801f2241cb1 ============================================================================= BUG kmalloc-512 (Tainted: G B ): kasan: bad access detected ----------------------------------------------------------------------------- INFO: Allocated in snd_seq_create_port+0x94/0x9b0 [snd_seq] age=1 cpu=3 pid=4511 ___slab_alloc+0x425/0x460 __slab_alloc+0x20/0x40 kmem_cache_alloc_trace+0x150/0x190 snd_seq_create_port+0x94/0x9b0 [snd_seq] snd_seq_ioctl_create_port+0xd1/0x630 [snd_seq] snd_seq_do_ioctl+0x11c/0x190 [snd_seq] snd_seq_ioctl+0x40/0x80 [snd_seq] do_vfs_ioctl+0x54b/0xda0 SyS_ioctl+0x79/0x90 entry_SYSCALL_64_fastpath+0x16/0x75 INFO: Freed in port_delete+0x136/0x1a0 [snd_seq] age=1 cpu=2 pid=4717 __slab_free+0x204/0x310 kfree+0x15f/0x180 port_delete+0x136/0x1a0 [snd_seq] snd_seq_delete_port+0x235/0x350 [snd_seq] snd_seq_ioctl_delete_port+0xc8/0x180 [snd_seq] snd_seq_do_ioctl+0x11c/0x190 [snd_seq] snd_seq_ioctl+0x40/0x80 [snd_seq] do_vfs_ioctl+0x54b/0xda0 SyS_ioctl+0x79/0x90 entry_SYSCALL_64_fastpath+0x16/0x75 Call Trace: [<ffffffff81b03781>] dump_stack+0x63/0x82 [<ffffffff81531b3b>] print_trailer+0xfb/0x160 [<ffffffff81536db4>] object_err+0x34/0x40 [<ffffffff815392d3>] kasan_report.part.2+0x223/0x520 [<ffffffffa07aadf4>] ? snd_seq_ioctl_create_port+0x504/0x630 [snd_seq] [<ffffffff815395fe>] __asan_report_load1_noabort+0x2e/0x30 [<ffffffffa07aadf4>] snd_seq_ioctl_create_port+0x504/0x630 [snd_seq] [<ffffffffa07aa8f0>] ? snd_seq_ioctl_delete_port+0x180/0x180 [snd_seq] [<ffffffff8136be50>] ? taskstats_exit+0xbc0/0xbc0 [<ffffffffa07abc5c>] snd_seq_do_ioctl+0x11c/0x190 [snd_seq] [<ffffffffa07abd10>] snd_seq_ioctl+0x40/0x80 [snd_seq] [<ffffffff8136d433>] ? acct_account_cputime+0x63/0x80 [<ffffffff815b515b>] do_vfs_ioctl+0x54b/0xda0 ..... We may fix this in a few different ways, and in this patch, it's fixed simply by taking the refcount properly at snd_seq_create_port() and letting the caller unref the object after use. Also, there is another potential use-after-free by sprintf() call in snd_seq_create_port(), and this is moved inside the lock. This fix covers CVE-2017-15265. Reported-and-tested-by: Michael23 Yu <[email protected]> Suggested-by: Linus Torvalds <[email protected]> Cc: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
void delayed_work_timer_fn(unsigned long __data) { struct delayed_work *dwork = (struct delayed_work *)__data; /* should have been called from irqsafe timer with irq already off */ __queue_work(dwork->cpu, dwork->wq, &dwork->work); }
0
[ "CWE-200" ]
tip
dfb4357da6ddbdf57d583ba64361c9d792b0e0b1
190,033,013,398,416,600,000,000,000,000,000,000,000
7
time: Remove CONFIG_TIMER_STATS Currently CONFIG_TIMER_STATS exposes process information across namespaces: kernel/time/timer_list.c print_timer(): SEQ_printf(m, ", %s/%d", tmp, timer->start_pid); /proc/timer_list: #11: <0000000000000000>, hrtimer_wakeup, S:01, do_nanosleep, cron/2570 Given that the tracer can give the same information, this patch entirely removes CONFIG_TIMER_STATS. Suggested-by: Thomas Gleixner <[email protected]> Signed-off-by: Kees Cook <[email protected]> Acked-by: John Stultz <[email protected]> Cc: Nicolas Pitre <[email protected]> Cc: [email protected] Cc: Lai Jiangshan <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Xing Gao <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Jessica Frazelle <[email protected]> Cc: [email protected] Cc: Nicolas Iooss <[email protected]> Cc: "Paul E. McKenney" <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Richard Cochran <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Michal Marek <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Cc: Olof Johansson <[email protected]> Cc: Andrew Morton <[email protected]> Cc: [email protected] Cc: Arjan van de Ven <[email protected]> Link: http://lkml.kernel.org/r/20170208192659.GA32582@beast Signed-off-by: Thomas Gleixner <[email protected]>
congestion_control_enabled(void) { const or_options_t *opts = NULL; tor_assert_nonfatal_once(in_main_thread()); opts = get_options(); /* If the user has set "__AlwaysCongesttionControl", * then always try to negotiate congestion control, regardless * of consensus param. This is to be used for testing and sbws. * * Note that we do *not* allow disabling congestion control * if the consensus says to use it, as this is bad for queueing * and fairness. */ if (opts->AlwaysCongestionControl) return 1; return cc_alg != CC_ALG_SENDME; }
0
[]
tor
b0496d40197dd5b4fb7b694c1410082d4e34dda6
226,845,317,677,745,920,000,000,000,000,000,000,000
20
Fix for RTT calculation hang during congestion control. Only cache RTT on explicit stalls; Only use this cache for the RTT decrease case. Otherwise use only local circuit RTT state for clock jump checks.
static int setup_rx_descbuffer(struct b43_dmaring *ring, struct b43_dmadesc_generic *desc, struct b43_dmadesc_meta *meta, gfp_t gfp_flags) { dma_addr_t dmaaddr; struct sk_buff *skb; B43_WARN_ON(ring->tx); skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); if (unlikely(!skb)) return -ENOMEM; b43_poison_rx_buffer(ring, skb); dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0); if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { /* ugh. try to realloc in zone_dma */ gfp_flags |= GFP_DMA; dev_kfree_skb_any(skb); skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags); if (unlikely(!skb)) return -ENOMEM; b43_poison_rx_buffer(ring, skb); dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0); if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) { b43err(ring->dev->wl, "RX DMA buffer allocation failed\n"); dev_kfree_skb_any(skb); return -EIO; } } meta->skb = skb; meta->dmaaddr = dmaaddr; ring->ops->fill_descriptor(ring, desc, dmaaddr, ring->rx_buffersize, 0, 0, 0); return 0; }
0
[ "CWE-119", "CWE-787" ]
linux
c85ce65ecac078ab1a1835c87c4a6319cf74660a
91,462,858,312,553,180,000,000,000,000,000,000,000
40
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 __cil_fill_expr_helper(struct cil_tree_node *current, enum cil_flavor flavor, struct cil_list *expr) { int rc = SEPOL_ERR; enum cil_flavor op; op = __cil_get_expr_operator_flavor(current->data); rc = cil_verify_expr_syntax(current, op, flavor); if (rc != SEPOL_OK) { goto exit; } if (op != CIL_NONE) { cil_list_append(expr, CIL_OP, (void *)op); current = current->next; } for (;current != NULL; current = current->next) { rc = __cil_fill_expr(current, flavor, expr); if (rc != SEPOL_OK) { goto exit; } } return SEPOL_OK; exit: return rc; }
0
[ "CWE-125" ]
selinux
340f0eb7f3673e8aacaf0a96cbfcd4d12a405521
84,649,531,932,486,210,000,000,000,000,000,000,000
29
libsepol/cil: Check for statements not allowed in optional blocks While there are some checks for invalid statements in an optional block when resolving the AST, there are no checks when building the AST. OSS-Fuzz found the following policy which caused a null dereference in cil_tree_get_next_path(). (blockinherit b3) (sid SID) (sidorder(SID)) (optional o (ibpkeycon :(1 0)s) (block b3 (filecon""block()) (filecon""block()))) The problem is that the blockinherit copies block b3 before the optional block is disabled. When the optional is disabled, block b3 is deleted along with everything else in the optional. Later, when filecon statements with the same path are found an error message is produced and in trying to find out where the block was copied from, the reference to the deleted block is used. The error handling code assumes (rightly) that if something was copied from a block then that block should still exist. It is clear that in-statements, blocks, and macros cannot be in an optional, because that allows nodes to be copied from the optional block to somewhere outside even though the optional could be disabled later. When optionals are disabled the AST is reset and the resolution is restarted at the point of resolving macro calls, so anything resolved before macro calls will never be re-resolved. This includes tunableifs, in-statements, blockinherits, blockabstracts, and macro definitions. Tunable declarations also cannot be in an optional block because they are needed to resolve tunableifs. It should be fine to allow blockinherit statements in an optional, because that is copying nodes from outside the optional to the optional and if the optional is later disabled, everything will be deleted anyway. Check and quit with an error if a tunable declaration, in-statement, block, blockabstract, or macro definition is found within an optional when either building or resolving the AST. Signed-off-by: James Carter <[email protected]>
static LogEst whereSortingCost( WhereInfo *pWInfo, LogEst nRow, int nOrderBy, int nSorted ){ /* TUNING: Estimated cost of a full external sort, where N is ** the number of rows to sort is: ** ** cost = (3.0 * N * log(N)). ** ** Or, if the order-by clause has X terms but only the last Y ** terms are out of order, then block-sorting will reduce the ** sorting cost to: ** ** cost = (3.0 * N * log(N)) * (Y/X) ** ** The (Y/X) term is implemented using stack variable rScale ** below. */ LogEst rScale, rSortCost; assert( nOrderBy>0 && 66==sqlite3LogEst(100) ); rScale = sqlite3LogEst((nOrderBy-nSorted)*100/nOrderBy) - 66; rSortCost = nRow + rScale + 16; /* Multiple by log(M) where M is the number of output rows. ** Use the LIMIT for M if it is smaller. Or if this sort is for ** a DISTINCT operator, M will be the number of distinct output ** rows, so fudge it downwards a bit. */ if( (pWInfo->wctrlFlags & WHERE_USE_LIMIT)!=0 && pWInfo->iLimit<nRow ){ nRow = pWInfo->iLimit; }else if( (pWInfo->wctrlFlags & WHERE_WANT_DISTINCT) ){ /* TUNING: In the sort for a DISTINCT operator, assume that the DISTINCT ** reduces the number of output rows by a factor of 2 */ if( nRow>10 ){ nRow -= 10; assert( 10==sqlite3LogEst(2) ); } } rSortCost += estLog(nRow); return rSortCost; }
0
[ "CWE-129" ]
sqlite
effc07ec9c6e08d3bd17665f8800054770f8c643
118,489,738,246,870,990,000,000,000,000,000,000,000
40
Fix the whereKeyStats() routine (part of STAT4 processing only) so that it is able to cope with row-value comparisons against the primary key index of a WITHOUT ROWID table. [forum:/forumpost/3607259d3c|Forum post 3607259d3c]. FossilOrigin-Name: 2a6f761864a462de5c2d5bc666b82fb0b7e124a03443cd1482620dde344b34bb
static int cbtls_verify(int ok, X509_STORE_CTX *ctx) { char subject[1024]; /* Used for the subject name */ char issuer[1024]; /* Used for the issuer name */ char attribute[1024]; char value[1024]; char common_name[1024]; char cn_str[1024]; char buf[64]; EAP_HANDLER *handler = NULL; X509 *client_cert; X509_CINF *client_inf; STACK_OF(X509_EXTENSION) *ext_list; X509 *issuer_cert; SSL *ssl; int err, depth, lookup, loc; EAP_TLS_CONF *conf; int my_ok = ok; REQUEST *request; ASN1_INTEGER *sn = NULL; ASN1_TIME *asn_time = NULL; #ifdef HAVE_OPENSSL_OCSP_H X509_STORE *ocsp_store = NULL; #endif client_cert = X509_STORE_CTX_get_current_cert(ctx); err = X509_STORE_CTX_get_error(ctx); depth = X509_STORE_CTX_get_error_depth(ctx); lookup = depth; /* * Log client/issuing cert. If there's an error, log * issuing cert. */ if ((lookup > 1) && !my_ok) lookup = 1; /* * Retrieve the pointer to the SSL of the connection currently treated * and the application specific data stored into the SSL object. */ ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); handler = (EAP_HANDLER *)SSL_get_ex_data(ssl, 0); request = handler->request; conf = (EAP_TLS_CONF *)SSL_get_ex_data(ssl, 1); #ifdef HAVE_OPENSSL_OCSP_H ocsp_store = (X509_STORE *)SSL_get_ex_data(ssl, 2); #endif /* * Get the Serial Number */ buf[0] = '\0'; sn = X509_get_serialNumber(client_cert); /* * For this next bit, we create the attributes *only* if * we're at the client or issuing certificate. */ if ((lookup <= 1) && sn && (sn->length < (sizeof(buf) / 2))) { char *p = buf; int i; for (i = 0; i < sn->length; i++) { sprintf(p, "%02x", (unsigned int)sn->data[i]); p += 2; } pairadd(&handler->certs, pairmake(cert_attr_names[EAPTLS_SERIAL][lookup], buf, T_OP_SET)); } /* * Get the Expiration Date */ buf[0] = '\0'; asn_time = X509_get_notAfter(client_cert); if ((lookup <= 1) && asn_time && (asn_time->length < sizeof(buf))) { memcpy(buf, (char*) asn_time->data, asn_time->length); buf[asn_time->length] = '\0'; pairadd(&handler->certs, pairmake(cert_attr_names[EAPTLS_EXPIRATION][lookup], buf, T_OP_SET)); } /* * Get the Subject & Issuer */ subject[0] = issuer[0] = '\0'; X509_NAME_oneline(X509_get_subject_name(client_cert), subject, sizeof(subject)); subject[sizeof(subject) - 1] = '\0'; if ((lookup <= 1) && subject[0] && (strlen(subject) < MAX_STRING_LEN)) { pairadd(&handler->certs, pairmake(cert_attr_names[EAPTLS_SUBJECT][lookup], subject, T_OP_SET)); } X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), issuer, sizeof(issuer)); issuer[sizeof(issuer) - 1] = '\0'; if ((lookup <= 1) && issuer[0] && (strlen(issuer) < MAX_STRING_LEN)) { pairadd(&handler->certs, pairmake(cert_attr_names[EAPTLS_ISSUER][lookup], issuer, T_OP_SET)); } /* * Get the Common Name, if there is a subject. */ X509_NAME_get_text_by_NID(X509_get_subject_name(client_cert), NID_commonName, common_name, sizeof(common_name)); common_name[sizeof(common_name) - 1] = '\0'; if ((lookup <= 1) && common_name[0] && subject[0] && (strlen(common_name) < MAX_STRING_LEN)) { pairadd(&handler->certs, pairmake(cert_attr_names[EAPTLS_CN][lookup], common_name, T_OP_SET)); } #ifdef GEN_EMAIL /* * Get the RFC822 Subject Alternative Name */ loc = X509_get_ext_by_NID(client_cert, NID_subject_alt_name, 0); if (lookup <= 1 && loc >= 0) { X509_EXTENSION *ext = NULL; GENERAL_NAMES *names = NULL; int i; if ((ext = X509_get_ext(client_cert, loc)) && (names = X509V3_EXT_d2i(ext))) { for (i = 0; i < sk_GENERAL_NAME_num(names); i++) { GENERAL_NAME *name = sk_GENERAL_NAME_value(names, i); switch (name->type) { case GEN_EMAIL: if (ASN1_STRING_length(name->d.rfc822Name) >= MAX_STRING_LEN) break; pairadd(&handler->certs, pairmake(cert_attr_names[EAPTLS_SAN_EMAIL][lookup], (char *)ASN1_STRING_data(name->d.rfc822Name), T_OP_SET)); break; default: /* XXX TODO handle other SAN types */ break; } } } if (names != NULL) sk_GENERAL_NAME_free(names); } #endif /* GEN_EMAIL */ /* * If the CRL has expired, that might still be OK. */ if (!my_ok && (conf->allow_expired_crl) && (err == X509_V_ERR_CRL_HAS_EXPIRED)) { my_ok = 1; X509_STORE_CTX_set_error( ctx, 0 ); } if (!my_ok) { const char *p = X509_verify_cert_error_string(err); radlog(L_ERR,"--> verify error:num=%d:%s\n",err, p); radius_pairmake(request, &request->packet->vps, "Module-Failure-Message", p, T_OP_SET); return my_ok; } if (lookup == 0) { client_inf = client_cert->cert_info; ext_list = client_inf->extensions; } else { ext_list = NULL; } /* * Grab the X509 extensions, and create attributes out of them. * For laziness, we re-use the OpenSSL names */ if (sk_X509_EXTENSION_num(ext_list) > 0) { int i, len; char *p; BIO *out; out = BIO_new(BIO_s_mem()); strlcpy(attribute, "TLS-Client-Cert-", sizeof(attribute)); for (i = 0; i < sk_X509_EXTENSION_num(ext_list); i++) { ASN1_OBJECT *obj; X509_EXTENSION *ext; VALUE_PAIR *vp; ext = sk_X509_EXTENSION_value(ext_list, i); obj = X509_EXTENSION_get_object(ext); i2a_ASN1_OBJECT(out, obj); len = BIO_read(out, attribute + 16 , sizeof(attribute) - 16 - 1); if (len <= 0) continue; attribute[16 + len] = '\0'; X509V3_EXT_print(out, ext, 0, 0); len = BIO_read(out, value, sizeof(value) - 1); if (len <= 0) continue; value[len] = '\0'; /* * Mash the OpenSSL name to our name, and * create the attribute. */ for (p = attribute + 16; *p != '\0'; p++) { if (*p == ' ') *p = '-'; } vp = pairmake(attribute, value, T_OP_ADD); if (vp) { pairadd(&handler->certs, vp); debug_pair_list(vp); } } BIO_free_all(out); } switch (ctx->error) { case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: radlog(L_ERR, "issuer= %s\n", issuer); break; case X509_V_ERR_CERT_NOT_YET_VALID: case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: radlog(L_ERR, "notBefore="); #if 0 ASN1_TIME_print(bio_err, X509_get_notBefore(ctx->current_cert)); #endif break; case X509_V_ERR_CERT_HAS_EXPIRED: case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: radlog(L_ERR, "notAfter="); #if 0 ASN1_TIME_print(bio_err, X509_get_notAfter(ctx->current_cert)); #endif break; } /* * If we're at the actual client cert, apply additional * checks. */ if (depth == 0) { /* * If the conf tells us to, check cert issuer * against the specified value and fail * verification if they don't match. */ if (conf->check_cert_issuer && (strcmp(issuer, conf->check_cert_issuer) != 0)) { radlog(L_AUTH, "rlm_eap_tls: Certificate issuer (%s) does not match specified value (%s)!", issuer, conf->check_cert_issuer); my_ok = 0; } /* * If the conf tells us to, check the CN in the * cert against xlat'ed value, but only if the * previous checks passed. */ if (my_ok && conf->check_cert_cn) { if (!radius_xlat(cn_str, sizeof(cn_str), conf->check_cert_cn, handler->request, NULL)) { radlog(L_ERR, "rlm_eap_tls (%s): xlat failed.", conf->check_cert_cn); /* if this fails, fail the verification */ my_ok = 0; } else { RDEBUG2("checking certificate CN (%s) with xlat'ed value (%s)", common_name, cn_str); if (strcmp(cn_str, common_name) != 0) { radlog(L_AUTH, "rlm_eap_tls: Certificate CN (%s) does not match specified value (%s)!", common_name, cn_str); my_ok = 0; } } } /* check_cert_cn */ #ifdef HAVE_OPENSSL_OCSP_H if (my_ok && conf->ocsp_enable){ RDEBUG2("--> Starting OCSP Request"); if (X509_STORE_CTX_get1_issuer(&issuer_cert, ctx, client_cert) != 1) { radlog(L_ERR, "Error: Couldn't get issuer_cert for %s", common_name); } else { my_ok = ocsp_check(ocsp_store, issuer_cert, client_cert, conf); } } #endif while (conf->verify_client_cert_cmd) { char filename[256]; int fd; FILE *fp; snprintf(filename, sizeof(filename), "%s/%s.client.XXXXXXXX", conf->verify_tmp_dir, progname); fd = mkstemp(filename); if (fd < 0) { RDEBUG("Failed creating file in %s: %s", conf->verify_tmp_dir, strerror(errno)); break; } fp = fdopen(fd, "w"); if (!fp) { RDEBUG("Failed opening file %s: %s", filename, strerror(errno)); break; } if (!PEM_write_X509(fp, client_cert)) { fclose(fp); RDEBUG("Failed writing certificate to file"); goto do_unlink; } fclose(fp); if (!radius_pairmake(request, &request->packet->vps, "TLS-Client-Cert-Filename", filename, T_OP_SET)) { RDEBUG("Failed creating TLS-Client-Cert-Filename"); goto do_unlink; } RDEBUG("Verifying client certificate: %s", conf->verify_client_cert_cmd); if (radius_exec_program(conf->verify_client_cert_cmd, request, 1, NULL, 0, EXEC_TIMEOUT, request->packet->vps, NULL, 1) != 0) { radlog(L_AUTH, "rlm_eap_tls: Certificate CN (%s) fails external verification!", common_name); my_ok = 0; } else { RDEBUG("Client certificate CN %s passed external validation", common_name); } do_unlink: unlink(filename); break; } } /* depth == 0 */ if (debug_flag > 0) { RDEBUG2("chain-depth=%d, ", depth); RDEBUG2("error=%d", err); RDEBUG2("--> User-Name = %s", handler->identity); RDEBUG2("--> BUF-Name = %s", common_name); RDEBUG2("--> subject = %s", subject); RDEBUG2("--> issuer = %s", issuer); RDEBUG2("--> verify return:%d", my_ok); } return my_ok; }
0
[ "CWE-295" ]
freeradius-server
5e698b407dcac2bc45cf03484bac4398109d25c3
78,845,657,668,554,490,000,000,000,000,000,000,000
363
Set X509_V_FLAG_CRL_CHECK_ALL
bool_on_stack(cctx_T *cctx) { type_T *type; type = get_type_on_stack(cctx, 0); if (type == &t_bool) return OK; if (type == &t_any || type == &t_unknown || type == &t_number || type == &t_number_bool) // Number 0 and 1 are OK to use as a bool. "any" could also be a bool. // This requires a runtime type check. return generate_COND2BOOL(cctx); return need_type(type, &t_bool, -1, 0, cctx, FALSE, FALSE); }
0
[ "CWE-200", "CWE-122" ]
vim
5f25c3855071bd7e26255c68bf458b1b5cf92f39
61,066,450,752,614,760,000,000,000,000,000,000,000
18
patch 8.2.4049: Vim9: reading before the start of the line with "$" Problem: Vim9: reading before the start of the line with "$" by itself. Solution: Do not subtract one when reporting the error.
Status explain(OperationContext* opCtx, const OpMsgRequest& request, ExplainOptions::Verbosity verbosity, BSONObjBuilder* out) const override { std::string dbname = request.getDatabase().toString(); const BSONObj& cmdObj = request.body; // Acquire locks and resolve possible UUID. The RAII object is optional, because in the case // of a view, the locks need to be released. boost::optional<AutoGetCollectionForReadCommand> ctx; ctx.emplace(opCtx, CommandHelpers::parseNsOrUUID(dbname, cmdObj), AutoGetCollection::ViewMode::kViewsPermitted); const auto nss = ctx->getNss(); const ExtensionsCallbackReal extensionsCallback(opCtx, &nss); auto parsedDistinct = uassertStatusOK(ParsedDistinct::parse(opCtx, nss, cmdObj, extensionsCallback, true)); if (ctx->getView()) { // Relinquish locks. The aggregation command will re-acquire them. ctx.reset(); auto viewAggregation = parsedDistinct.asAggregationCommand(); if (!viewAggregation.isOK()) { return viewAggregation.getStatus(); } auto viewAggRequest = AggregationRequest::parseFromBSON(nss, viewAggregation.getValue(), verbosity); if (!viewAggRequest.isOK()) { return viewAggRequest.getStatus(); } return runAggregate( opCtx, nss, viewAggRequest.getValue(), viewAggregation.getValue(), *out); } Collection* const collection = ctx->getCollection(); auto executor = uassertStatusOK(getExecutorDistinct(opCtx, collection, nss.ns(), &parsedDistinct)); Explain::explainStages(executor.get(), collection, verbosity, out); return Status::OK(); }
1
[ "CWE-20" ]
mongo
d315547544d7146b93a8e6e94cc4b88cd0d19c95
129,405,377,919,576,930,000,000,000,000,000,000,000
45
SERVER-38275 ban explain with UUID
static void lsr_translate_anim_value(GF_LASeRCodec *lsr, SMIL_AnimateValue *val, u32 coded_type) { switch (val->type) { case SVG_StrokeDashArray_datatype: //if list of fixed only if (coded_type == 8) { SVG_StrokeDashArray *da; GF_List *l = (GF_List *)val->value; u32 i; GF_SAFEALLOC(da, SVG_StrokeDashArray); if (!da) { lsr->last_error = GF_OUT_OF_MEM; return; } da->array.count = gf_list_count(l); if (!da->array.count) { da->type = SVG_STROKEDASHARRAY_INHERIT; } else { da->type = SVG_STROKEDASHARRAY_ARRAY; da->array.vals = (Fixed *) gf_malloc(sizeof(Fixed)*da->array.count); da->array.units = (u8 *) gf_malloc(sizeof(u8)*da->array.count); if (!da->array.vals || !da->array.units) { lsr->last_error = GF_OUT_OF_MEM; return; } for (i=0; i<da->array.count; i++) { Fixed *v = (Fixed *)gf_list_get(l, i); da->array.vals[i] = *v; da->array.units[i] = 0; gf_free(v); } } gf_list_del(l); val->value = da; return; } break; case SVG_ViewBox_datatype: //if list of fixed only if (coded_type == 8) { SVG_ViewBox *vb; GF_List *l = (GF_List *)val->value; GF_SAFEALLOC(vb, SVG_ViewBox); if (!vb) { lsr->last_error = GF_OUT_OF_MEM; return; } if (gf_list_count(l)==4) { vb->x = * ((Fixed *)gf_list_get(l, 0)); vb->y = * ((Fixed *)gf_list_get(l, 1)); vb->width = * ((Fixed *)gf_list_get(l, 2)); vb->height = * ((Fixed *)gf_list_get(l, 3)); } while (gf_list_count(l)) { Fixed *v = (Fixed *)gf_list_last(l); gf_free(v); gf_list_rem_last(l); } gf_list_del(l); val->value = vb; return; } break; case SVG_Coordinates_datatype: { SVG_Coordinates *coords; if (coded_type==1) { GF_List *l = gf_list_new(); /*allocated value is already an SVG number*/ gf_list_add(l, val->value); coords = (SVG_Coordinates*)gf_malloc(sizeof(SVG_Coordinates)); if (!coords) { lsr->last_error = GF_OUT_OF_MEM; } else { *coords = l; val->value = coords; } return; } else if (coded_type==8) { GF_List *l = (GF_List *)val->value; u32 i, count = gf_list_count(l); for (i=0; i<count; i++) { SVG_Coordinate *c; Fixed *v = (Fixed *)gf_list_get(l, i); c = (SVG_Coordinate*)gf_malloc(sizeof(SVG_Coordinate)); if (!c) { lsr->last_error = GF_OUT_OF_MEM; } else { c->type = SVG_NUMBER_VALUE; c->value = *v; } gf_free(v); gf_list_rem(l, i); if (c) gf_list_insert(l, c, i); } coords = (SVG_Coordinates*)gf_malloc(sizeof(SVG_Coordinates)); if (!coords) { lsr->last_error = GF_OUT_OF_MEM; } else { *coords = (GF_List *) val->value; val->value = coords; } return; } } break; case SVG_Motion_datatype: if (coded_type==9) { GF_Matrix2D *mat; SVG_Point *pt = (SVG_Point *)val->value; GF_SAFEALLOC(mat, GF_Matrix2D); if (mat) { gf_mx2d_init(*mat); mat->m[2] = pt->x; mat->m[5] = pt->y; val->value = mat; } else { lsr->last_error = GF_OUT_OF_MEM; } gf_free(pt); return; } break; default: break; } lsr_delete_anim_value(lsr, val, coded_type); }
0
[ "CWE-190" ]
gpac
faa75edde3dfeba1e2cf6ffa48e45a50f1042096
30,565,671,311,536,180,000,000,000,000,000,000,000
130
fixed #2213
//! Load gif file, using ImageMagick or GraphicsMagick's external tools. /** \param filename Filename to read data from. **/ CImgList<T>& load_gif_external(const char *const filename) { if (!filename) throw CImgArgumentException(_cimglist_instance "load_gif_external(): Specified filename is (null).", cimglist_instance); cimg::fclose(cimg::fopen(filename,"rb")); // Check if file exists if (!_load_gif_external(filename,false)) if (!_load_gif_external(filename,true)) try { assign(CImg<T>().load_other(filename)); } catch (CImgException&) { assign(); } if (is_empty()) throw CImgIOException(_cimglist_instance
0
[ "CWE-119", "CWE-787" ]
CImg
ac8003393569aba51048c9d67e1491559877b1d1
219,470,547,311,104,950,000,000,000,000,000,000,000
15
.
dump_routerlist_mem_usage(int severity) { uint64_t livedescs = 0; uint64_t olddescs = 0; if (!routerlist) return; SMARTLIST_FOREACH(routerlist->routers, routerinfo_t *, r, livedescs += r->cache_info.signed_descriptor_len); SMARTLIST_FOREACH(routerlist->old_routers, signed_descriptor_t *, sd, olddescs += sd->signed_descriptor_len); log(severity, LD_DIR, "In %d live descriptors: "U64_FORMAT" bytes. " "In %d old descriptors: "U64_FORMAT" bytes.", smartlist_len(routerlist->routers), U64_PRINTF_ARG(livedescs), smartlist_len(routerlist->old_routers), U64_PRINTF_ARG(olddescs)); }
0
[ "CWE-399" ]
tor
308f6dad20675c42b29862f4269ad1fbfb00dc9a
311,226,250,377,559,040,000,000,000,000,000,000,000
17
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 int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg, const ASN1_STRING *sig, int indent, ASN1_PCTX *pctx) { DSA_SIG *dsa_sig; const unsigned char *p; if (!sig) { if (BIO_puts(bp, "\n") <= 0) return 0; else return 1; } p = sig->data; dsa_sig = d2i_DSA_SIG(NULL, &p, sig->length); if (dsa_sig) { int rv = 0; size_t buf_len = 0; unsigned char *m = NULL; update_buflen(dsa_sig->r, &buf_len); update_buflen(dsa_sig->s, &buf_len); m = OPENSSL_malloc(buf_len + 10); if (m == NULL) { DSAerr(DSA_F_DSA_SIG_PRINT, ERR_R_MALLOC_FAILURE); goto err; } if (BIO_write(bp, "\n", 1) != 1) goto err; if (!ASN1_bn_print(bp, "r: ", dsa_sig->r, m, indent)) goto err; if (!ASN1_bn_print(bp, "s: ", dsa_sig->s, m, indent)) goto err; rv = 1; err: OPENSSL_free(m); DSA_SIG_free(dsa_sig); return rv; } return X509_signature_dump(bp, sig, indent); }
0
[]
openssl
ab4a81f69ec88d06c9d8de15326b9296d7f498ed
245,429,661,636,279,400,000,000,000,000,000,000,000
40
Remove broken DSA private key workarounds. Remove old code that handled various invalid DSA formats in ancient software. This also fixes a double free bug when parsing malformed DSA private keys. Thanks to Adam Langley (Google/BoringSSL) for discovering this bug using libFuzzer. CVE-2016-0705 Reviewed-by: Emilia Käsper <[email protected]>
apr_status_t h2_mplx_pop_task(h2_mplx *m, h2_task **ptask) { apr_status_t rv = APR_EOF; *ptask = NULL; ap_assert(m); ap_assert(m->lock); if (APR_SUCCESS != (rv = apr_thread_mutex_lock(m->lock))) { return rv; } if (m->aborted) { rv = APR_EOF; } else { *ptask = next_stream_task(m); rv = (*ptask != NULL && !h2_iq_empty(m->q))? APR_EAGAIN : APR_SUCCESS; } if (APR_EAGAIN != rv) { m->is_registered = 0; /* h2_workers will discard this mplx */ } H2_MPLX_LEAVE(m); return rv; }
0
[ "CWE-444" ]
mod_h2
825de6a46027b2f4c30d7ff5a0c8b852d639c207
185,299,704,042,264,130,000,000,000,000,000,000,000
25
* Fixed keepalives counter on slave connections.
enum_field_types field_type_for_temporal_comparison(const Item *other) const { if (cmp_type() == TIME_RESULT) { if (other->cmp_type() == TIME_RESULT) return Field::field_type_merge(field_type(), other->field_type()); else return field_type(); } else { if (other->cmp_type() == TIME_RESULT) return other->field_type(); DBUG_ASSERT(0); // Two non-temporal data types, we should not get to here return MYSQL_TYPE_DATETIME; } }
0
[ "CWE-617" ]
server
2e7891080667c59ac80f788eef4d59d447595772
108,793,612,182,775,600,000,000,000,000,000,000,000
17
MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view This bug could manifest itself after pushing a where condition over a mergeable derived table / view / CTE DT into a grouping view / derived table / CTE V whose item list contained set functions with constant arguments such as MIN(2), SUM(1) etc. In such cases the field references used in the condition pushed into the view V that correspond set functions are wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation of the virtual method const_item() for the class Item_direct_view_ref the wrapped set functions with constant arguments could be erroneously taken for constant items. This could lead to a wrong result set returned by the main select query in 10.2. In 10.4 where a possibility of pushing condition from HAVING into WHERE had been added this could cause a crash. Approved by Sergey Petrunya <[email protected]>
static int session_headers_add_pad(nghttp2_session *session, nghttp2_frame *frame) { int rv; ssize_t padded_payloadlen; nghttp2_active_outbound_item *aob; nghttp2_bufs *framebufs; size_t padlen; size_t max_payloadlen; aob = &session->aob; framebufs = &aob->framebufs; max_payloadlen = nghttp2_min(NGHTTP2_MAX_PAYLOADLEN, frame->hd.length + NGHTTP2_MAX_PADLEN); padded_payloadlen = session_call_select_padding(session, frame, max_payloadlen); if (nghttp2_is_fatal((int)padded_payloadlen)) { return (int)padded_payloadlen; } padlen = (size_t)padded_payloadlen - frame->hd.length; DEBUGF("send: padding selected: payloadlen=%zd, padlen=%zu\n", padded_payloadlen, padlen); rv = nghttp2_frame_add_pad(framebufs, &frame->hd, padlen, 0); if (rv != 0) { return rv; } frame->headers.padlen = padlen; return 0; }
0
[]
nghttp2
0a6ce87c22c69438ecbffe52a2859c3a32f1620f
59,682,663,175,123,010,000,000,000,000,000,000,000
37
Add nghttp2_option_set_max_outbound_ack
Field *Field_blob::new_key_field(MEM_ROOT *root, TABLE *new_table, uchar *new_ptr, uint32 length, uchar *new_null_ptr, uint new_null_bit) { Field_varstring *res= new (root) Field_varstring(new_ptr, length, 2, new_null_ptr, new_null_bit, Field::NONE, &field_name, table->s, charset()); res->init(new_table); return res; }
0
[ "CWE-416", "CWE-703" ]
server
08c7ab404f69d9c4ca6ca7a9cf7eec74c804f917
281,178,793,253,580,000,000,000,000,000,000,000,000
12
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]>
bool Curl_meets_timecondition(struct Curl_easy *data, time_t timeofdoc) { if((timeofdoc == 0) || (data->set.timevalue == 0)) return TRUE; switch(data->set.timecondition) { case CURL_TIMECOND_IFMODSINCE: default: if(timeofdoc <= data->set.timevalue) { infof(data, "The requested document is not new enough"); data->info.timecond = TRUE; return FALSE; } break; case CURL_TIMECOND_IFUNMODSINCE: if(timeofdoc >= data->set.timevalue) { infof(data, "The requested document is not old enough"); data->info.timecond = TRUE; return FALSE; } break; } return TRUE; }
0
[]
curl
620ea21410030a9977396b4661806bc187231b79
234,742,286,586,030,800,000,000,000,000,000,000,000
27
transfer: redirects to other protocols or ports clear auth ... unless explicitly permitted. Bug: https://curl.se/docs/CVE-2022-27774.html Reported-by: Harry Sintonen Closes #8748
static inline struct htx_blk *htx_add_trailer(struct htx *htx, const struct ist name, const struct ist value) { struct htx_blk *blk; /* FIXME: check name.len (< 256B) and value.len (< 1MB) */ blk = htx_add_blk(htx, HTX_BLK_TLR, name.len + value.len); if (!blk) return NULL; blk->info += (value.len << 8) + name.len; ist2bin_lc(htx_get_blk_ptr(htx, blk), name); memcpy(htx_get_blk_ptr(htx, blk) + name.len, value.ptr, value.len); return blk; }
1
[ "CWE-190" ]
haproxy
3b69886f7dcc3cfb3d166309018e6cfec9ce2c95
330,050,885,029,992,750,000,000,000,000,000,000,000
15
BUG/MAJOR: htx: fix missing header name length check in htx_add_header/trailer Ori Hollander of JFrog Security reported that htx_add_header() and htx_add_trailer() were missing a length check on the header name. While this does not allow to overwrite any memory area, it results in bits of the header name length to slip into the header value length and may result in forging certain header names on the input. The sad thing here is that a FIXME comment was present suggesting to add the required length checks :-( The injected headers are visible to the HTTP internals and to the config rules, so haproxy will generally stay synchronized with the server. But there is one exception which is the content-length header field, because it is already deduplicated on the input, but before being indexed. As such, injecting a content-length header after the deduplication stage may be abused to present a different, shorter one on the other side and help build a request smuggling attack, or even maybe a response splitting attack. CVE-2021-40346 was assigned to this problem. As a mitigation measure, it is sufficient to verify that no more than one such header is present in any message, which is normally the case thanks to the duplicate checks: http-request deny if { req.hdr_cnt(content-length) gt 1 } http-response deny if { res.hdr_cnt(content-length) gt 1 } This must be backported to all HTX-enabled versions, hence as far as 2.0. In 2.3 and earlier, the functions are in src/htx.c instead. Many thanks to Ori for his work and his responsible report!
load_font( XOC oc) { XOCGenericPart *gen = XOC_GENERIC(oc); FontSet font_set = gen->font_set; int num = gen->font_set_num; for ( ; num-- > 0; font_set++) { if (font_set->font_name == NULL) continue; if (load_fontset_data (oc, font_set) != True) return False; #ifndef TESTVERSION if(load_fontdata(oc, font_set->font_data, font_set->font_data_count) != True) return False; if(load_fontdata(oc, font_set->substitute, font_set->substitute_num) != True) return False; #endif /* Add 1996.05.20 */ if( oc->core.orientation == XOMOrientation_TTB_RTL || oc->core.orientation == XOMOrientation_TTB_LTR ){ if (font_set->vpart_initialize == 0) { load_fontdata(oc, font_set->vmap, font_set->vmap_num); load_fontdata(oc, (FontData) font_set->vrotate, font_set->vrotate_num); font_set->vpart_initialize = 1; } } if (font_set->font->min_byte1 || font_set->font->max_byte1) font_set->is_xchar2b = True; else font_set->is_xchar2b = False; } return True; }
0
[ "CWE-190" ]
libx11
acdaaadcb3d85c61fd43669fc5dddf0f8c3f911d
72,016,872,277,597,520,000,000,000,000,000,000,000
42
Fix an integer overflow in init_om() CVE-2020-14363 This can lead to a double free later, as reported by Jayden Rivers. Signed-off-by: Matthieu Herrb <[email protected]>
QUInt16(const uint16_t v) : value(v) {}
0
[ "CWE-908", "CWE-787" ]
tensorflow
ace0c15a22f7f054abcc1f53eabbcb0a1239a9e2
60,698,451,866,556,200,000,000,000,000,000,000,000
1
Default initialize fixed point Eigen types. In certain cases, tensors are filled with default values of the type. But, for these fixed point types, these values were uninitialized. Thus, we would have uninitialized memory access bugs, some of which were caught by MSAN. PiperOrigin-RevId: 344101137 Change-Id: I14555fda74dca3b5f1582da9008901937e3f14e2
static int vsock_getname(struct socket *sock, struct sockaddr *addr, int *addr_len, int peer) { int err; struct sock *sk; struct vsock_sock *vsk; struct sockaddr_vm *vm_addr; sk = sock->sk; vsk = vsock_sk(sk); err = 0; lock_sock(sk); if (peer) { if (sock->state != SS_CONNECTED) { err = -ENOTCONN; goto out; } vm_addr = &vsk->remote_addr; } else { vm_addr = &vsk->local_addr; } if (!vm_addr) { err = -EINVAL; goto out; } /* sys_getsockname() and sys_getpeername() pass us a * MAX_SOCK_ADDR-sized buffer and don't set addr_len. Unfortunately * that macro is defined in socket.c instead of .h, so we hardcode its * value here. */ BUILD_BUG_ON(sizeof(*vm_addr) > 128); memcpy(addr, vm_addr, sizeof(*vm_addr)); *addr_len = sizeof(*vm_addr); out: release_sock(sk); return err; }
0
[ "CWE-20", "CWE-269" ]
linux
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
152,940,054,358,128,200,000,000,000,000,000,000,000
42
net: rework recvmsg handler msg_name and msg_namelen logic This patch now always passes msg->msg_namelen as 0. recvmsg handlers must set msg_namelen to the proper size <= sizeof(struct sockaddr_storage) to return msg_name to the user. This prevents numerous uninitialized memory leaks we had in the recvmsg handlers and makes it harder for new code to accidentally leak uninitialized memory. Optimize for the case recvfrom is called with NULL as address. We don't need to copy the address at all, so set it to NULL before invoking the recvmsg handler. We can do so, because all the recvmsg handlers must cope with the case a plain read() is called on them. read() also sets msg_name to NULL. Also document these changes in include/linux/net.h as suggested by David Miller. Changes since RFC: Set msg->msg_name = NULL if user specified a NULL in msg_name but had a non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't affect sendto as it would bail out earlier while trying to copy-in the address. It also more naturally reflects the logic by the callers of verify_iovec. With this change in place I could remove " if (!uaddr || msg_sys->msg_namelen == 0) msg->msg_name = NULL ". This change does not alter the user visible error logic as we ignore msg_namelen as long as msg_name is NULL. Also remove two unnecessary curly brackets in ___sys_recvmsg and change comments to netdev style. Cc: David Miller <[email protected]> Suggested-by: Eric Dumazet <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int selinux_socket_getpeersec_stream(struct socket *sock, char __user *optval, int __user *optlen, unsigned len) { int err = 0; char *scontext; u32 scontext_len; struct sk_security_struct *sksec = sock->sk->sk_security; u32 peer_sid = SECSID_NULL; if (sksec->sclass == SECCLASS_UNIX_STREAM_SOCKET || sksec->sclass == SECCLASS_TCP_SOCKET) peer_sid = sksec->peer_sid; if (peer_sid == SECSID_NULL) return -ENOPROTOOPT; err = security_sid_to_context(peer_sid, &scontext, &scontext_len); if (err) return err; if (scontext_len > len) { err = -ERANGE; goto out_len; } if (copy_to_user(optval, scontext, scontext_len)) err = -EFAULT; out_len: if (put_user(scontext_len, optlen)) err = -EFAULT; kfree(scontext); return err; }
0
[ "CWE-264" ]
linux
259e5e6c75a910f3b5e656151dc602f53f9d7548
135,660,570,986,069,360,000,000,000,000,000,000,000
33
Add PR_{GET,SET}_NO_NEW_PRIVS to prevent execve from granting privs With this change, calling prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) disables privilege granting operations at execve-time. For example, a process will not be able to execute a setuid binary to change their uid or gid if this bit is set. The same is true for file capabilities. Additionally, LSM_UNSAFE_NO_NEW_PRIVS is defined to ensure that LSMs respect the requested behavior. To determine if the NO_NEW_PRIVS bit is set, a task may call prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0); It returns 1 if set and 0 if it is not set. If any of the arguments are non-zero, it will return -1 and set errno to -EINVAL. (PR_SET_NO_NEW_PRIVS behaves similarly.) This functionality is desired for the proposed seccomp filter patch series. By using PR_SET_NO_NEW_PRIVS, it allows a task to modify the system call behavior for itself and its child tasks without being able to impact the behavior of a more privileged task. Another potential use is making certain privileged operations unprivileged. For example, chroot may be considered "safe" if it cannot affect privileged tasks. Note, this patch causes execve to fail when PR_SET_NO_NEW_PRIVS is set and AppArmor is in use. It is fixed in a subsequent patch. Signed-off-by: Andy Lutomirski <[email protected]> Signed-off-by: Will Drewry <[email protected]> Acked-by: Eric Paris <[email protected]> Acked-by: Kees Cook <[email protected]> v18: updated change desc v17: using new define values as per 3.4 Signed-off-by: James Morris <[email protected]>
const CString& CUser::GetCleanUserName() const { return m_sCleanUserName; }
0
[ "CWE-20" ]
znc
64613bc8b6b4adf1e32231f9844d99cd512b8973
84,636,547,140,411,790,000,000,000,000,000,000,000
1
Don't crash if user specified invalid encoding. This is CVE-2019-9917
void force_vm_exit(const cpumask_t *mask) { smp_call_function_many(mask, exit_vm_noop, NULL, true); }
0
[ "CWE-399", "CWE-284" ]
linux
e8180dcaa8470ceca21109f143876fdcd9fe050a
52,300,283,805,278,170,000,000,000,000,000,000,000
4
ARM: KVM: prevent NULL pointer dereferences with KVM VCPU ioctl Some ARM KVM VCPU ioctls require the vCPU to be properly initialized with the KVM_ARM_VCPU_INIT ioctl before being used with further requests. KVM_RUN checks whether this initialization has been done, but other ioctls do not. Namely KVM_GET_REG_LIST will dereference an array with index -1 without initialization and thus leads to a kernel oops. Fix this by adding checks before executing the ioctl handlers. [ Removed superflous comment from static function - Christoffer ] Changes from v1: * moved check into a static function with a meaningful name Signed-off-by: Andre Przywara <[email protected]> Signed-off-by: Christoffer Dall <[email protected]>
gs_main_lib_open(gs_main_instance * minst, const char *file_name, ref * pfile) { /* This is a separate procedure only to avoid tying up */ /* extra stack space while running the file. */ i_ctx_t *i_ctx_p = minst->i_ctx_p; #define maxfn 2048 char fn[maxfn]; uint len; return lib_file_open(&minst->lib_path, imemory, NULL, /* Don't check permissions here, because permlist isn't ready running init files. */ file_name, strlen(file_name), fn, maxfn, &len, pfile); }
0
[]
ghostpdl
6d444c273da5499a4cd72f21cb6d4c9a5256807d
274,127,139,413,712,670,000,000,000,000,000,000,000
14
Bug 697178: Add a file permissions callback For the rare occasions when the graphics library directly opens a file (currently for reading), this allows us to apply any restrictions on file access normally applied in the interpteter.
static void test_bug43560(void) { MYSQL* conn; uint rc; MYSQL_STMT *stmt= 0; MYSQL_BIND bind; my_bool is_null= 0; char buffer[256]; const uint BUFSIZE= sizeof(buffer); const char* values[] = {"eins", "zwei", "drei", "viele", NULL}; const char insert_str[] = "INSERT INTO t1 (c2) VALUES (?)"; unsigned long length; const unsigned int drop_db= opt_drop_db; DBUG_ENTER("test_bug43560"); myheader("test_bug43560"); /* Make sure we only run against a debug server. */ if (!strstr(mysql->server_version, "debug")) { fprintf(stdout, "Skipping test_bug43560: server not DEBUG version\n"); DBUG_VOID_RETURN; } /* Set up a separate connection for this test to avoid messing up the general MYSQL object used in other subtests. Use TCP protocol to avoid problems with the buffer semantics of AF_UNIX, and turn off auto reconnect. */ conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0); rc= mysql_query(conn, "DROP TABLE IF EXISTS t1"); myquery(rc); rc= mysql_query(conn, "CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 CHAR(10))"); myquery(rc); stmt= mysql_stmt_init(conn); check_stmt(stmt); rc= mysql_stmt_prepare(stmt, insert_str, strlen(insert_str)); check_execute(stmt, rc); memset(&bind, 0, sizeof(bind)); bind.buffer_type= MYSQL_TYPE_STRING; bind.buffer_length= BUFSIZE; bind.buffer= buffer; bind.is_null= &is_null; bind.length= &length; rc= mysql_stmt_bind_param(stmt, &bind); check_execute(stmt, rc); /* First execute; should succeed. */ strncpy(buffer, values[0], BUFSIZE); length= strlen(buffer); rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); /* Set up the server to close this session's server-side socket after next execution of prep statement. */ rc= mysql_query(conn,"SET SESSION debug='+d,close_conn_after_stmt_execute'"); myquery(rc); /* Second execute; should fail due to socket closed during execution. */ strncpy(buffer, values[1], BUFSIZE); length= strlen(buffer); rc= mysql_stmt_execute(stmt); DIE_UNLESS(rc && mysql_stmt_errno(stmt) == CR_SERVER_LOST); /* Third execute; should fail (connection already closed), or SIGSEGV in case of a Bug#43560 type regression in which case the whole test fails. */ strncpy(buffer, values[2], BUFSIZE); length= strlen(buffer); rc= mysql_stmt_execute(stmt); DIE_UNLESS(rc && mysql_stmt_errno(stmt) == CR_SERVER_LOST); mysql_stmt_close(stmt); opt_drop_db= 0; client_disconnect(conn); rc= mysql_query(mysql, "DROP TABLE t1"); myquery(rc); opt_drop_db= drop_db; DBUG_VOID_RETURN; }
0
[ "CWE-284", "CWE-295" ]
mysql-server
3bd5589e1a5a93f9c224badf983cd65c45215390
293,974,118,814,949,900,000,000,000,000,000,000,000
89
WL#6791 : Redefine client --ssl option to imply enforced encryption # Changed the meaning of the --ssl=1 option of all client binaries to mean force ssl, not try ssl and fail over to eunecrypted # Added a new MYSQL_OPT_SSL_ENFORCE mysql_options() option to specify that an ssl connection is required. # Added a new macro SSL_SET_OPTIONS() to the client SSL handling headers that sets all the relevant SSL options at once. # Revamped all of the current native clients to use the new macro # Removed some Windows line endings. # Added proper handling of the new option into the ssl helper headers. # If SSL is mandatory assume that the media is secure enough for the sha256 plugin to do unencrypted password exchange even before establishing a connection. # Set the default ssl cipher to DHE-RSA-AES256-SHA if none is specified. # updated test cases that require a non-default cipher to spawn a mysql command line tool binary since mysqltest has no support for specifying ciphers. # updated the replication slave connection code to always enforce SSL if any of the SSL config options is present. # test cases added and updated. # added a mysql_get_option() API to return mysql_options() values. Used the new API inside the sha256 plugin. # Fixed compilation warnings because of unused variables. # Fixed test failures (mysql_ssl and bug13115401) # Fixed whitespace issues. # Fully implemented the mysql_get_option() function. # Added a test case for mysql_get_option() # fixed some trailing whitespace issues # fixed some uint/int warnings in mysql_client_test.c # removed shared memory option from non-windows get_options tests # moved MYSQL_OPT_LOCAL_INFILE to the uint options
qf_jump_edit_buffer( qf_info_T *qi, qfline_T *qf_ptr, int forceit, int prev_winid, int *opened_window) { qf_list_T *qfl = qf_get_curlist(qi); int old_changedtick = qfl->qf_changedtick; qfltype_T qfl_type = qfl->qfl_type; int retval = OK; int old_qf_curlist = qi->qf_curlist; int save_qfid = qfl->qf_id; if (qf_ptr->qf_type == 1) { // Open help file (do_ecmd() will set b_help flag, readfile() will // set b_p_ro flag). if (!can_abandon(curbuf, forceit)) { no_write_message(); return FAIL; } retval = do_ecmd(qf_ptr->qf_fnum, NULL, NULL, NULL, (linenr_T)1, ECMD_HIDE + ECMD_SET_HELP, prev_winid == curwin->w_id ? curwin : NULL); } else retval = buflist_getfile(qf_ptr->qf_fnum, (linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit); // If a location list, check whether the associated window is still // present. if (qfl_type == QFLT_LOCATION) { win_T *wp = win_id2wp(prev_winid); if (wp == NULL && curwin->w_llist != qi) { emsg(_(e_current_window_was_closed)); *opened_window = FALSE; return QF_ABORT; } } if (qfl_type == QFLT_QUICKFIX && !qflist_valid(NULL, save_qfid)) { emsg(_(e_current_quickfix_list_was_changed)); return QF_ABORT; } // Check if the list was changed. The pointers may happen to be identical, // thus also check qf_changedtick. if (old_qf_curlist != qi->qf_curlist || old_changedtick != qfl->qf_changedtick || !is_qf_entry_present(qfl, qf_ptr)) { if (qfl_type == QFLT_QUICKFIX) emsg(_(e_current_quickfix_list_was_changed)); else emsg(_(e_current_location_list_was_changed)); return QF_ABORT; } return retval; }
0
[ "CWE-416" ]
vim
4f1b083be43f351bc107541e7b0c9655a5d2c0bb
247,509,510,388,900,130,000,000,000,000,000,000,000
67
patch 9.0.0322: crash when no errors and 'quickfixtextfunc' is set Problem: Crash when no errors and 'quickfixtextfunc' is set. Solution: Do not handle errors if there aren't any.
static ssize_t lo_add_fd_mapping(fuse_req_t req, int fd) { struct lo_map_elem *elem; elem = lo_map_alloc_elem(&lo_data(req)->fd_map); if (!elem) { return -1; } elem->fd = fd; return elem - lo_data(req)->fd_map.elems; }
0
[]
qemu
6084633dff3a05d63176e06d7012c7e15aba15be
222,372,605,976,086,140,000,000,000,000,000,000,000
12
tools/virtiofsd: xattr name mappings: Add option Add an option to define mappings of xattr names so that the client and server filesystems see different views. This can be used to have different SELinux mappings as seen by the guest, to run the virtiofsd with less privileges (e.g. in a case where it can't set trusted/system/security xattrs but you want the guest to be able to), or to isolate multiple users of the same name; e.g. trusted attributes used by stacking overlayfs. A mapping engine is used with 3 simple rules; the rules can be combined to allow most useful mapping scenarios. The ruleset is defined by -o xattrmap='rules...'. This patch doesn't use the rule maps yet. Signed-off-by: Dr. David Alan Gilbert <[email protected]> Message-Id: <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Signed-off-by: Dr. David Alan Gilbert <[email protected]>
void Compute(OpKernelContext* context) override { const Tensor& tensor_in = context->input(0); const Tensor& tensor_out = context->input(1); const Tensor& out_grad_backprop = context->input(2); // For maxpooling3d, tensor_in should have 5 dimensions. OP_REQUIRES(context, tensor_in.dims() == 5, errors::InvalidArgument("tensor_in must be 5-dimensional")); OP_REQUIRES(context, tensor_out.dims() == 5, errors::InvalidArgument("tensor_out must be 5-dimensional")); // For maxpooling3d, out_grad_backprop should have 5 dimensions. OP_REQUIRES( context, out_grad_backprop.dims() == 5, errors::InvalidArgument("out_grad_backprop must be 5-dimensional")); Pool3dParameters params{context, ksize_, stride_, padding_, data_format_, tensor_in.shape()}; Tensor* output = nullptr; OP_REQUIRES_OK(context, context->forward_input_or_allocate_output( {2}, 0, tensor_out.shape(), &output)); // Given access patterns in LaunchMaxPooling3dGradGradOp, these tensors must // have elements. OP_REQUIRES(context, tensor_in.NumElements() > 0, errors::InvalidArgument("received empty tensor tensor_in: ", tensor_in.DebugString())); OP_REQUIRES(context, tensor_out.NumElements() > 0, errors::InvalidArgument("received empty tensor tensor_out: ", tensor_out.DebugString())); OP_REQUIRES( context, out_grad_backprop.NumElements() > 0, errors::InvalidArgument("received empty tensor out_grad_backprop: ", out_grad_backprop.DebugString())); LaunchMaxPooling3dGradGradOp<Device, T>::launch( context, params, tensor_in, tensor_out, out_grad_backprop, output); }
1
[ "CWE-369", "CWE-787" ]
tensorflow
63c6a29d0f2d692b247f7bf81f8732d6442fad09
93,004,229,093,993,130,000,000,000,000,000,000,000
38
Add missing validation, prevent heap OOB PiperOrigin-RevId: 372246723 Change-Id: I1a454a643810e77d7d14821b342098c56a09fbbf
void derive_temporal_luma_vector_prediction(base_context* ctx, de265_image* img, const slice_segment_header* shdr, int xP,int yP, int nPbW,int nPbH, int refIdxL, int X, // which MV (L0/L1) to get MotionVector* out_mvLXCol, uint8_t* out_availableFlagLXCol) { // --- no temporal MVP -> exit --- if (shdr->slice_temporal_mvp_enabled_flag == 0) { out_mvLXCol->x = 0; out_mvLXCol->y = 0; *out_availableFlagLXCol = 0; return; } // --- find collocated reference image --- int Log2CtbSizeY = img->get_sps().Log2CtbSizeY; int colPic; // TODO: this is the same for the whole slice. We can precompute it. if (shdr->slice_type == SLICE_TYPE_B && shdr->collocated_from_l0_flag == 0) { logtrace(LogMotion,"collocated L1 ref_idx=%d\n",shdr->collocated_ref_idx); colPic = shdr->RefPicList[1][ shdr->collocated_ref_idx ]; } else { logtrace(LogMotion,"collocated L0 ref_idx=%d\n",shdr->collocated_ref_idx); colPic = shdr->RefPicList[0][ shdr->collocated_ref_idx ]; } // check whether collocated reference picture exists if (!ctx->has_image(colPic)) { out_mvLXCol->x = 0; out_mvLXCol->y = 0; *out_availableFlagLXCol = 0; ctx->add_warning(DE265_WARNING_NONEXISTING_REFERENCE_PICTURE_ACCESSED, false); return; } // --- get collocated MV either at bottom-right corner or from center of PB --- int xColPb,yColPb; int yColBr = yP + nPbH; // bottom right collocated motion vector position int xColBr = xP + nPbW; /* If neighboring pixel at bottom-right corner is in the same CTB-row and inside the image, use this (reduced down to 16 pixels resolution) as collocated MV position. Note: see 2014, Sze, Sect. 5.2.1.2 why candidate C0 is excluded when on another CTB-row. This is to reduce the memory bandwidth requirements. */ if ((yP>>Log2CtbSizeY) == (yColBr>>Log2CtbSizeY) && xColBr < img->get_sps().pic_width_in_luma_samples && yColBr < img->get_sps().pic_height_in_luma_samples) { xColPb = xColBr & ~0x0F; // reduce resolution of collocated motion-vectors to 16 pixels grid yColPb = yColBr & ~0x0F; derive_collocated_motion_vectors(ctx,img,shdr, xP,yP, colPic, xColPb,yColPb, refIdxL, X, out_mvLXCol, out_availableFlagLXCol); } else { out_mvLXCol->x = 0; out_mvLXCol->y = 0; *out_availableFlagLXCol = 0; } if (*out_availableFlagLXCol==0) { int xColCtr = xP+(nPbW>>1); int yColCtr = yP+(nPbH>>1); xColPb = xColCtr & ~0x0F; // reduce resolution of collocated motion-vectors to 16 pixels grid yColPb = yColCtr & ~0x0F; derive_collocated_motion_vectors(ctx,img,shdr, xP,yP, colPic, xColPb,yColPb, refIdxL, X, out_mvLXCol, out_availableFlagLXCol); } }
0
[ "CWE-787" ]
libde265
697aa4f7c774abd6374596e6707a6f4f54265355
78,853,456,832,637,830,000,000,000,000,000,000,000
95
fix MC with HDR chroma, but SDR luma (#301)
unsigned int msix_nr_vectors_allocated(const PCIDevice *dev) { return dev->msix_entries_nr; }
0
[]
qemu
43b11a91dd861a946b231b89b7542856ade23d1b
156,517,482,348,897,520,000,000,000,000,000,000,000
4
msix: implement pba write (but read-only) qpci_msix_pending() writes on pba region, causing qemu to SEGV: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffff7fba8c0 (LWP 25882)] 0x0000000000000000 in ?? () (gdb) bt #0 0x0000000000000000 in () #1 0x00005555556556c5 in memory_region_oldmmio_write_accessor (mr=0x5555579f3f80, addr=0, value=0x7fffffffbf68, size=4, shift=0, mask=4294967295, attrs=...) at /home/elmarco/src/qemu/memory.c:434 #2 0x00005555556558e1 in access_with_adjusted_size (addr=0, value=0x7fffffffbf68, size=4, access_size_min=1, access_size_max=4, access=0x55555565563e <memory_region_oldmmio_write_accessor>, mr=0x5555579f3f80, attrs=...) at /home/elmarco/src/qemu/memory.c:506 #3 0x00005555556581eb in memory_region_dispatch_write (mr=0x5555579f3f80, addr=0, data=0, size=4, attrs=...) at /home/elmarco/src/qemu/memory.c:1176 #4 0x000055555560b6f9 in address_space_rw (as=0x555555eff4e0 <address_space_memory>, addr=3759147008, attrs=..., buf=0x7fffffffc1b0 "", len=4, is_write=true) at /home/elmarco/src/qemu/exec.c:2439 #5 0x000055555560baa2 in cpu_physical_memory_rw (addr=3759147008, buf=0x7fffffffc1b0 "", len=4, is_write=1) at /home/elmarco/src/qemu/exec.c:2534 #6 0x000055555564c005 in cpu_physical_memory_write (addr=3759147008, buf=0x7fffffffc1b0, len=4) at /home/elmarco/src/qemu/include/exec/cpu-common.h:80 #7 0x000055555564cd9c in qtest_process_command (chr=0x55555642b890, words=0x5555578de4b0) at /home/elmarco/src/qemu/qtest.c:378 #8 0x000055555564db77 in qtest_process_inbuf (chr=0x55555642b890, inbuf=0x55555641b340) at /home/elmarco/src/qemu/qtest.c:569 #9 0x000055555564dc07 in qtest_read (opaque=0x55555642b890, buf=0x7fffffffc2e0 "writel 0xe0100800 0x0\n", size=22) at /home/elmarco/src/qemu/qtest.c:581 #10 0x000055555574ce3e in qemu_chr_be_write (s=0x55555642b890, buf=0x7fffffffc2e0 "writel 0xe0100800 0x0\n", len=22) at qemu-char.c:306 #11 0x0000555555751263 in tcp_chr_read (chan=0x55555642bcf0, cond=G_IO_IN, opaque=0x55555642b890) at qemu-char.c:2876 #12 0x00007ffff64c9a8a in g_main_context_dispatch (context=0x55555641c400) at gmain.c:3122 (without this patch, this can be reproduced with the ivshmem qtest) Implement an empty mmio write to avoid the crash. Signed-off-by: Marc-André Lureau <[email protected]> Reviewed-by: Paolo Bonzini <[email protected]>
g_markup_parse_context_get_element_stack (GMarkupParseContext *context) { g_return_val_if_fail (context != NULL, NULL); return context->tag_stack; }
0
[ "CWE-476" ]
glib
fccef3cc822af74699cca84cd202719ae61ca3b9
74,309,225,371,993,750,000,000,000,000,000,000,000
5
gmarkup: Fix crash in error handling path for closing elements If something which looks like a closing tag is left unfinished, but isn’t paired to an opening tag in the document, the error handling code would do a null pointer dereference. Avoid that, at the cost of introducing a new translatable error message. Includes a test case, courtesy of pdknsk. Signed-off-by: Philip Withnall <[email protected]> https://gitlab.gnome.org/GNOME/glib/issues/1461
NOEXPORT void socks5_client_address(CLI *c) { SOCKADDR_UNION addr; SOCKS5_UNION socks; if(original_dst(c->local_rfd.fd, &addr)) throw_exception(c, 2); /* don't reset */ memset(&socks, 0, sizeof socks); socks.req.ver=5; /* SOCKS5 */ socks.req.cmd=0x01; /* CONNECT */ switch(addr.sa.sa_family) { case AF_INET: socks.req.atyp=0x01; /* IP v4 address */ memcpy(&socks.v4.addr, &addr.in.sin_addr, 4); memcpy(&socks.v4.port, &addr.in.sin_port, 2); s_log(LOG_INFO, "Sending SOCKS5 IPv4 address"); s_ssl_write(c, &socks, sizeof socks.v4); break; #ifdef USE_IPv6 case AF_INET6: socks.req.atyp=0x04; /* IP v6 address */ memcpy(&socks.v6.addr, &addr.in6.sin6_addr, 16); memcpy(&socks.v6.port, &addr.in6.sin6_port, 2); s_log(LOG_INFO, "Sending SOCKS5 IPv6 address"); s_ssl_write(c, &socks, sizeof socks.v6); break; #endif default: s_log(LOG_ERR, "Unsupported address type 0x%02x", addr.sa.sa_family); throw_exception(c, 2); /* don't reset */ } s_ssl_read(c, &socks, sizeof socks.resp); if(socks.resp.atyp==0x04) /* IP V6 address */ s_ssl_read(c, &socks.v6.addr, 16+2); else s_ssl_read(c, &socks.v4.addr, 4+2); if(socks.resp.ver!=5) { s_log(LOG_ERR, "Invalid SOCKS5 message version 0x%02x", socks.req.ver); throw_exception(c, 2); /* don't reset */ } switch(socks.resp.rep) { case 0x00: s_log(LOG_INFO, "SOCKS5 request succeeded"); return; /* SUCCESS */ case 0x01: s_log(LOG_ERR, "SOCKS5 request failed: General SOCKS server failure"); break; case 0x02: s_log(LOG_ERR, "SOCKS5 request failed: Connection not allowed by ruleset"); break; case 0x03: s_log(LOG_ERR, "SOCKS5 request failed: Network unreachable"); break; case 0x04: s_log(LOG_ERR, "SOCKS5 request failed: Host unreachable"); break; case 0x05: s_log(LOG_ERR, "SOCKS5 request failed: Connection refused"); break; case 0x06: s_log(LOG_ERR, "SOCKS5 request failed: TTL expired"); break; case 0x07: s_log(LOG_ERR, "SOCKS5 request failed: Command not supported"); break; case 0x08: s_log(LOG_ERR, "SOCKS5 request failed: Address type not supported"); break; default: s_log(LOG_ERR, "SOCKS5 request failed: Unknown error 0x%02x", socks.resp.rep); } throw_exception(c, 2); /* don't reset */ }
0
[ "CWE-295" ]
stunnel
ebad9ddc4efb2635f37174c9d800d06206f1edf9
126,465,878,301,109,950,000,000,000,000,000,000,000
83
stunnel-5.57
inline bool SegmentBuilder::tryExtend(word* from, word* to) { // Careful about overflow. if (pos == from && to <= ptr.end() && to >= from) { pos = to; return true; } else { return false; } }
0
[ "CWE-20" ]
capnproto
52bc956459a5e83d7c31be95763ff6399e064ae4
124,321,379,359,121,420,000,000,000,000,000,000,000
9
SECURITY: Prevent compiler from eliding bounds checks. Details: https://github.com/sandstorm-io/capnproto/blob/master/security-advisories/2017-04-17-0-apple-32bit-elides-bounds-check.md
void usbip_vhci_driver_close(void) { if (!vhci_driver) return; udev_device_unref(vhci_driver->hc_device); free(vhci_driver); vhci_driver = NULL; udev_unref(udev_context); }
0
[ "CWE-200" ]
linux
2f2d0088eb93db5c649d2a5e34a3800a8a935fc5
288,361,945,319,833,630,000,000,000,000,000,000,000
13
usbip: prevent vhci_hcd driver from leaking a socket pointer address When a client has a USB device attached over IP, the vhci_hcd driver is locally leaking a socket pointer address via the /sys/devices/platform/vhci_hcd/status file (world-readable) and in debug output when "usbip --debug port" is run. Fix it to not leak. The socket pointer address is not used at the moment and it was made visible as a convenient way to find IP address from socket pointer address by looking up /proc/net/{tcp,tcp6}. As this opens a security hole, the fix replaces socket pointer address with sockfd. Reported-by: Secunia Research <[email protected]> Cc: stable <[email protected]> Signed-off-by: Shuah Khan <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
static UChar32 escLeftBracket5Routine(UChar32 c) { c = readUnicodeCharacter(); if (c == 0) return 0; return doDispatch(c, escLeftBracket5Dispatch); }
0
[ "CWE-200" ]
mongo
035cf2afc04988b22cb67f4ebfd77e9b344cb6e0
62,670,691,675,568,315,000,000,000,000,000,000,000
6
SERVER-25335 avoid group and other permissions when creating .dbshell history file
bool CModules::OnClientDisconnect() { MODUNLOADCHK(OnClientDisconnect()); return false; }
0
[ "CWE-20", "CWE-264" ]
znc
8de9e376ce531fe7f3c8b0aa4876d15b479b7311
76,649,686,786,855,730,000,000,000,000,000,000,000
4
Fix remote code execution and privilege escalation vulnerability. To trigger this, need to have a user already. Thanks for Jeriko One <[email protected]> for finding and reporting this. CVE-2019-12816
static size_t ZSTD_resetCCtx_byCopyingCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict, ZSTD_CCtx_params params, U64 pledgedSrcSize, ZSTD_buffered_policy_e zbuff) { const ZSTD_compressionParameters *cdict_cParams = &cdict->matchState.cParams; DEBUGLOG(4, "copying dictionary into context"); { unsigned const windowLog = params.cParams.windowLog; assert(windowLog != 0); /* Copy only compression parameters related to tables. */ params.cParams = *cdict_cParams; params.cParams.windowLog = windowLog; ZSTD_resetCCtx_internal(cctx, params, pledgedSrcSize, ZSTDcrp_noMemset, zbuff); assert(cctx->appliedParams.cParams.strategy == cdict_cParams->strategy); assert(cctx->appliedParams.cParams.hashLog == cdict_cParams->hashLog); assert(cctx->appliedParams.cParams.chainLog == cdict_cParams->chainLog); } /* copy tables */ { size_t const chainSize = (cdict_cParams->strategy == ZSTD_fast) ? 0 : ((size_t)1 << cdict_cParams->chainLog); size_t const hSize = (size_t)1 << cdict_cParams->hashLog; size_t const tableSpace = (chainSize + hSize) * sizeof(U32); assert((U32*)cctx->blockState.matchState.chainTable == (U32*)cctx->blockState.matchState.hashTable + hSize); /* chainTable must follow hashTable */ assert((U32*)cctx->blockState.matchState.hashTable3 == (U32*)cctx->blockState.matchState.chainTable + chainSize); assert((U32*)cdict->matchState.chainTable == (U32*)cdict->matchState.hashTable + hSize); /* chainTable must follow hashTable */ assert((U32*)cdict->matchState.hashTable3 == (U32*)cdict->matchState.chainTable + chainSize); memcpy(cctx->blockState.matchState.hashTable, cdict->matchState.hashTable, tableSpace); /* presumes all tables follow each other */ } /* Zero the hashTable3, since the cdict never fills it */ { size_t const h3Size = (size_t)1 << cctx->blockState.matchState.hashLog3; assert(cdict->matchState.hashLog3 == 0); memset(cctx->blockState.matchState.hashTable3, 0, h3Size * sizeof(U32)); } /* copy dictionary offsets */ { ZSTD_matchState_t const* srcMatchState = &cdict->matchState; ZSTD_matchState_t* dstMatchState = &cctx->blockState.matchState; dstMatchState->window = srcMatchState->window; dstMatchState->nextToUpdate = srcMatchState->nextToUpdate; dstMatchState->nextToUpdate3= srcMatchState->nextToUpdate3; dstMatchState->loadedDictEnd= srcMatchState->loadedDictEnd; } cctx->dictID = cdict->dictID; /* copy block state */ memcpy(cctx->blockState.prevCBlock, &cdict->cBlockState, sizeof(cdict->cBlockState)); return 0; }
0
[ "CWE-362" ]
zstd
3e5cdf1b6a85843e991d7d10f6a2567c15580da0
239,866,699,541,020,040,000,000,000,000,000,000,000
55
fixed T36302429
int kvm_emulate_invd(struct kvm_vcpu *vcpu) { /* Treat an INVD instruction as a NOP and just skip it. */ return kvm_emulate_as_nop(vcpu); }
0
[ "CWE-476" ]
linux
55749769fe608fa3f4a075e42e89d237c8e37637
336,462,869,252,012,020,000,000,000,000,000,000,000
5
KVM: x86: Fix wall clock writes in Xen shared_info not to mark page dirty When dirty ring logging is enabled, any dirty logging without an active vCPU context will cause a kernel oops. But we've already declared that the shared_info page doesn't get dirty tracking anyway, since it would be kind of insane to mark it dirty every time we deliver an event channel interrupt. Userspace is supposed to just assume it's always dirty any time a vCPU can run or event channels are routed. So stop using the generic kvm_write_wall_clock() and just write directly through the gfn_to_pfn_cache that we already have set up. We can make kvm_write_wall_clock() static in x86.c again now, but let's not remove the 'sec_hi_ofs' argument even though it's not used yet. At some point we *will* want to use that for KVM guests too. Fixes: 629b5348841a ("KVM: x86/xen: update wallclock region") Reported-by: butt3rflyh4ck <[email protected]> Signed-off-by: David Woodhouse <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
struct wireless_dev *brcmf_ap_add_vif(struct wiphy *wiphy, const char *name, u32 *flags, struct vif_params *params) { struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct brcmf_if *ifp = netdev_priv(cfg_to_ndev(cfg)); struct brcmf_cfg80211_vif *vif; int err; if (brcmf_cfg80211_vif_event_armed(cfg)) return ERR_PTR(-EBUSY); brcmf_dbg(INFO, "Adding vif \"%s\"\n", name); vif = brcmf_alloc_vif(cfg, NL80211_IFTYPE_AP); if (IS_ERR(vif)) return (struct wireless_dev *)vif; brcmf_cfg80211_arm_vif_event(cfg, vif); err = brcmf_cfg80211_request_ap_if(ifp); if (err) { brcmf_cfg80211_arm_vif_event(cfg, NULL); goto fail; } /* wait for firmware event */ err = brcmf_cfg80211_wait_vif_event(cfg, BRCMF_E_IF_ADD, BRCMF_VIF_EVENT_TIMEOUT); brcmf_cfg80211_arm_vif_event(cfg, NULL); if (!err) { brcmf_err("timeout occurred\n"); err = -EIO; goto fail; } /* interface created in firmware */ ifp = vif->ifp; if (!ifp) { brcmf_err("no if pointer provided\n"); err = -ENOENT; goto fail; } strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1); err = brcmf_net_attach(ifp, true); if (err) { brcmf_err("Registering netdevice failed\n"); goto fail; } return &ifp->vif->wdev; fail: brcmf_free_vif(vif); return ERR_PTR(err); }
0
[ "CWE-119", "CWE-703" ]
linux
ded89912156b1a47d940a0c954c43afbabd0c42c
308,367,313,991,033,950,000,000,000,000,000,000,000
56
brcmfmac: avoid potential stack overflow in brcmf_cfg80211_start_ap() User-space can choose to omit NL80211_ATTR_SSID and only provide raw IE TLV data. When doing so it can provide SSID IE with length exceeding the allowed size. The driver further processes this IE copying it into a local variable without checking the length. Hence stack can be corrupted and used as exploit. Cc: [email protected] # v4.7 Reported-by: Daxing Guo <[email protected]> Reviewed-by: Hante Meuleman <[email protected]> Reviewed-by: Pieter-Paul Giesberts <[email protected]> Reviewed-by: Franky Lin <[email protected]> Signed-off-by: Arend van Spriel <[email protected]> Signed-off-by: Kalle Valo <[email protected]>