code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
function Q(ma,Aa){da.innerHTML="";if(0<ma.length){var Da=document.createElement("table"); Da.setAttribute("cellpadding","2");Da.style.boxSizing="border-box";Da.style.tableLayout="fixed";Da.style.width="100%";var Ca=document.createElement("tbody");if(null!=ma&&0<ma.length)for(var oa=0;oa<ma.length;oa++)(function(Ba){var...
cwe
CWE-94
JavaScript
/* SPDX-License-Identifier: LGPL-2.1+ */ #include <netinet/tcp.h> #include "alloc-util.h" #include "fd-util.h" #include "io-util.h" #include "missing.h" #include "resolved-dns-stream.h" #define DNS_STREAM_TIMEOUT_USEC (10 * USEC_PER_SEC) #define DNS_STREAMS_MAX 128 static void dns_stream_stop(DnsStream *s) { ...
cwe
CWE-416
C/C++
/* * Copyright (c) 2019-2021 GeyserMC. http://geysermc.org * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy,...
cwe
CWE-287
Java
static Variant _php_mb_regex_ereg_replace_exec(const Variant& pattern, const String& replacement, const String& str, const String& option, ...
cwe
CWE-125
C/C++
text(notificationName, data) { const username = `<span>${formatUsername(data.display_username)}</span>`; let description; if (data.topic_title) { description = `<span data-topic-id="${this.attrs.topic_id}">${data.topic_title}</span>`; } else { description = this.description(data)...
cwe
CWE-79
Ruby
TfLiteStatus ResizeOutputTensor(TfLiteContext* context, const TfLiteTensor* data, const TfLiteTensor* segment_ids, TfLiteTensor* output) { int max_index = -1; const int segment_id_size = segment_ids->dims->data[0]; if ...
cwe
CWE-787
Unknown
/* * Copyright (C) 2017 ~ 2017 Deepin Technology Co., Ltd. * * Author: zccrs <zccrs@live.com> * * Maintainer: zccrs <zhangjide@deepin.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foun...
cwe
CWE-362
C/C++
_gnutls_ciphertext2compressed (gnutls_session_t session, opaque * compress_data, int compress_size, gnutls_datum_t ciphertext, uint8_t type, record_parameters_st * params) { uint8_t MAC[MAX_HASH...
cwe
CWE-310
C/C++
gss_init_sec_context (minor_status, claimant_cred_handle, context_handle, target_name, req_mech_type, req_flags, time_req, input_chan_bindings, ...
cwe
CWE-415
C/C++
int ldb_msg_add_value(struct ldb_message *msg, const char *attr_name, const struct ldb_val *val, struct ldb_message_element **return_el) { struct ldb_message_element *el; struct ldb_val *vals; int ret; el = ldb_msg_find_element(msg, attr_name); if (!el) { ret = ldb_msg_add_empty(msg, att...
cwe
CWE-200
Unknown
PHP_FUNCTION(imagesetstyle) { zval *IM, *styles; gdImagePtr im; int * stylearr; int index; HashPosition pos; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra", &IM, &styles) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd); /* copy the style values in the style...
cwe
CWE-703
Unknown
void rose_start_hbtimer(struct sock *sk) { struct rose_sock *rose = rose_sk(sk); del_timer(&rose->timer); rose->timer.function = rose_timer_expiry; rose->timer.expires = jiffies + rose->hb; add_timer(&rose->timer); }
cwe
CWE-416
Unknown
int ssl3_enc(SSL *s, int send) { SSL3_RECORD *rec; EVP_CIPHER_CTX *ds; unsigned long l; int bs,i,mac_size=0; const EVP_CIPHER *enc; if (send) { ds=s->enc_write_ctx; rec= &(s->s3->wrec); if (s->enc_write_ctx == NULL) enc=NULL; else enc=EVP_CIPHER_CTX_cipher(s->enc_write_ctx); } else { ds=s...
cwe
CWE-310
Unknown
static void do_server_recv(int f_in, int f_out, int argc, char *argv[]) { int exit_code; struct file_list *flist; char *local_name = NULL; int negated_levels; if (filesfrom_fd >= 0 && !msgs2stderr && protocol_version < 31) { /* We can't mix messages with files-from data on the socket, * so temporarily turn o...
cwe
CWE-59
Unknown
static int kvaser_usb_leaf_flush_queue(struct kvaser_usb_net_priv *priv) { struct kvaser_cmd *cmd; int rc; cmd = kmalloc(sizeof(*cmd), GFP_KERNEL); if (!cmd) return -ENOMEM; cmd->id = CMD_FLUSH_QUEUE; cmd->len = CMD_HEADER_LEN + sizeof(struct kvaser_cmd_flush_queue); cmd->u.flush_queue.channel = priv->channe...
cwe
CWE-908
Unknown
njs_promise_perform_all_settled_handler(njs_vm_t *vm, njs_iterator_args_t *args, njs_value_t *value, int64_t index) { njs_int_t ret; njs_array_t *array; njs_value_t arguments[2], next; njs_function_t *on_fulfilled, *on_rejected; ...
cwe
CWE-416
Unknown
fill_info_if_stats(void *data, interface_info_t *interface_info) { struct info_if_stats **ifsp = (struct info_if_stats **)data; struct info_if_stats *ifs = *ifsp; endpt *ep = interface_info->ep; ZERO(*ifs); if (IS_IPV6(&ep->sin)) { if (!client_v6_capable) { return; } ifs->v6_flag = 1; ifs->unaddr.ad...
cwe
CWE-476
Unknown
INST_HANDLER (cpse) { // CPSE Rd, Rr int r = (buf[0] & 0xf) | ((buf[1] & 0x2) << 3); int d = ((buf[0] >> 4) & 0xf) | ((buf[1] & 0x1) << 4); RAnalOp next_op; // calculate next instruction size (call recursively avr_op_analyze) // and free next_op's esil string (we dont need it now) avr_op_analyze (anal, &next_...
cwe
CWE-416
Unknown
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
cwe
CWE-502
Python
uploads.upload = async function (socket, data) { const methodToFunc = { 'user.uploadCroppedPicture': socketUser.uploadCroppedPicture, 'user.updateCover': socketUser.updateCover, 'groups.cover.update': socketGroup.cover.update, }; if (!socket.uid || !data || !data.chunk || !data.params || !data.params.method ||...
cwe
CWE-1321
JavaScript
static int sctp_setsockopt_hmac_ident(struct sock *sk, char __user *optval, int optlen) { struct sctp_hmacalgo *hmacs; int err; if (!sctp_auth_enable) return -EACCES; if (optlen < sizeof(struct sctp_hmacalgo)) return -EINVAL; hmacs = kmalloc(optlen, GFP_KERNEL); if (!hmacs) return -ENOMEM...
cwe
CWE-200
Unknown
void WebContentsImpl::RunJavaScriptDialog(RenderFrameHost* render_frame_host, const base::string16& message, const base::string16& default_prompt, const GURL& frame_url, ...
cwe
CWE-20
C/C++
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, 0); TfLiteTensor* output_index_tensor = GetOutput(context, node, 1); TF_LITE_ENSURE_EQ(context, NumElements(output_index_tensor), NumElements(input)); switch (input->type) { ...
cwe
CWE-787
C/C++
static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, size_t count, loff_t *offset) { struct snd_timer_user *tu; long result = 0, unit; int qhead; int err = 0; tu = file->private_data; unit = tu->tread ? sizeof(struct snd_timer_tread) : sizeof(struct snd_timer_read); spin_lock_irq(&t...
cwe
CWE-200
Unknown
pub(super) fn parse_fixes<'i, 'b>(input: Input<'i, 'b>) -> PResult<'i, 'b, Rule<'i>> { alt(( try_map( pair(Token::Not, opt(parse_fixes)), |(_, rule)| { if let Some(mut rule) = rule { rule.negate()?; Ok(rule) } el...
cwe
CWE-674
Rust
package extractor import ( "archive/zip" "fmt" "io" "io/ioutil" "os" "os/exec" "path/filepath" ) type zipExtractor struct{} func NewZip() Extractor { return &zipExtractor{} } func (e *zipExtractor) Extract(src, dest string) error { srcType, err := mimeType(src) if err != nil { return err } switch src...
cwe
CWE-22
Go
/* xml++.cc * libxml++ and this file are copyright (C) 2000 by Ari Johnson, and * are covered by the GNU Lesser General Public License, which should be * included with libxml++ as the file COPYING. * Modified for Ardour and released under the same terms. */ #include <iostream> #include "pbd/stacktrace.h" #includ...
cwe
CWE-416
C/C++
rsvg_cairo_pop_render_stack (RsvgDrawingCtx * ctx) { RsvgCairoRender *render = RSVG_CAIRO_RENDER (ctx->render); cairo_t *child_cr = render->cr; gboolean lateclip = FALSE; cairo_surface_t *surface = NULL; RsvgState *state = rsvg_current_state (ctx); gboolean nest; if (rsvg_current_state (ctx...
cwe
CWE-20
Unknown
char *FLTGetIsLikeComparisonExpression(FilterEncodingNode *psFilterNode) { const size_t bufferSize = 1024; char szBuffer[1024]; char szTmp[256]; char *pszValue = NULL; const char *pszWild = NULL; const char *pszSingle = NULL; const char *pszEscape = NULL; int bCaseInsensitive = 0; int nLength=0, i=...
cwe
CWE-119
C/C++
def __init__(self, hs): super().__init__(hs) self.http_client = SimpleHttpClient(hs) # We create a blacklisting instance of SimpleHttpClient for contacting identity # servers specified by clients self.blacklisting_http_client = SimpleHttpClient( hs, ip_blacklist=hs.c...
cwe
CWE-601
Python
byte* decode_base64(char* src,size_t ssize, size_t *ret_len) { byte* outbuf; byte* retbuf; char* inb; int i; int l; int left; int pos; unsigned long triple; /* Exit on empty input */ if (!ssize||src==NULL) { log_msg(LOG_LEVEL_DEBUG, "decode base64: empty string"); return NULL; } /* In...
cwe
CWE-787
Unknown
// Copyright (C) Extensible Service Proxy Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless re...
cwe
CWE-290
C/C++
public static function getSName($zdb, $id, $wid = false, $wnick = false) { try { $select = $zdb->select(self::TABLE); $select->where(self::PK . ' = ' . $id); $results = $zdb->execute($select); $row = $results->current(); return self::getNameWithCa...
cwe
CWE-89
PHP
chunk_grow(chunk_t *chunk, size_t sz) { off_t offset; size_t memlen_orig = chunk->memlen; tor_assert(sz > chunk->memlen); offset = chunk->data - chunk->mem; chunk = tor_realloc(chunk, CHUNK_ALLOC_SIZE(sz)); chunk->memlen = sz; chunk->data = chunk->mem + offset; #ifdef DEBUG_CHUNK_ALLOC tor_assert(chunk-...
cwe
CWE-119
C/C++
static int rdn_name_modify(struct ldb_module *module, struct ldb_request *req) { struct ldb_context *ldb; const struct ldb_val *rdn_val_p; struct ldb_message_element *e = NULL; struct ldb_control *recalculate_rdn_control = NULL; ldb = ldb_module_get_ctx(module); /* do not manipulate our control entries */ if (...
cwe
CWE-200
Unknown
static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, const uint8_t *buf, int buf_size, int first_field) { int i, cid, ret; int old_bit_depth = ctx->bit_depth, bitdepth; uint64_t header_prefix; if (buf_size < 0x280) { av_l...
cwe
CWE-125
Unknown
static int local_unlinkat(FsContext *ctx, V9fsPath *dir, const char *name, int flags) { int ret; int dirfd; dirfd = local_opendir_nofollow(ctx, dir->data); if (dirfd == -1) { return -1; } ret = local_unlinkat_common(ctx, dirfd, name, flags); close_preserve...
cwe
CWE-732
Unknown
static void FillRectangle(rfbClient* client, int x, int y, int w, int h, uint32_t colour) { int i,j; if (client->frameBuffer == NULL) { return; } #define FILL_RECT(BPP) \ for(j=y*client->width;j<(y+h)*client->width;j+=client->width) \ for(i=x;i<x+w;i++) \ ((uint##BPP##_t*)client->frameBuffer)[j...
cwe
CWE-119
Unknown
"""Tornado handlers for kernels.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import json import logging from tornado import gen, web from tornado.concurrent import Future from tornado.ioloop import IOLoop from IPython.utils.jsonutil import date_default from...
cwe
CWE-79
Python
QPDF::flattenPagesTree() { // If not already done, flatten the /Pages structure and // initialize pageobj_to_pages_pos. if (! this->m->pageobj_to_pages_pos.empty()) { return; } // Push inherited objects down to the /Page level. As a side // effect this->m->all_pages will also be g...
cwe
CWE-787
Unknown
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
cwe
CWE-415
Python
SPL_METHOD(SplFileObject, fwrite) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *str; int str_len; long length = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &length) == FAILURE) { return; } if (ZEND_NUM_ARG...
cwe
CWE-190
C/C++
/* * Copyright © 2015-2018 Aeneas Rekkas <aeneas+oss@aeneas.io> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required...
cwe
CWE-345
Go
TfLiteStatus ResizeOutput(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* top_k = GetInput(context, node, kInputTopK); // INT32 number of top results is supported. TF_LITE_ENSURE_TYPES_EQ(context, top_k->type, kTfLiteInt32); // Check that the tensor contains only one value. TF_LITE_ENSURE_EQ(c...
cwe
CWE-787
C/C++
// SPDX-License-Identifier: GPL-2.0-only /* * AMD Cryptographic Coprocessor (CCP) driver * * Copyright (C) 2013-2019 Advanced Micro Devices, Inc. * * Author: Tom Lendacky <thomas.lendacky@amd.com> * Author: Gary R Hook <gary.hook@amd.com> */ #include <linux/dma-mapping.h> #include <linux/module.h> #include <lin...
cwe
CWE-401
Python
void ihevcd_parse_sei_payload(codec_t *ps_codec, UWORD32 u4_payload_type, UWORD32 u4_payload_size, WORD8 i1_nal_type) { parse_ctxt_t *ps_parse = &ps_codec->s_parse; bitstrm_t *ps_bitstrm = &ps_parse->s_bitstrm; WORD32 payloa...
cwe
CWE-787
C/C++
static int setup_config(int type) { int rv; rv = read_config(cl.configfile, type); if (rv < 0) goto out; if (is_auth_req()) { rv = read_authkey(); if (rv < 0) goto out; #if HAVE_LIBGCRYPT if (!gcry_check_version(NULL)) { log_error("gcry_check_version"); rv = -ENOENT; goto out; } gcry_contr...
cwe
CWE-284
C/C++
def add_acl_role(session, name, description) cmd = [PCS, "acl", "role", "create", name.to_s] if description.to_s != "" cmd << "description=#{description.to_s}" end stdout, stderror, retval = run_cmd(session, *cmd) if retval != 0 return stderror.join("\n").strip end return "" end
cwe
CWE-384
Ruby
# -*- coding: utf-8 -*- # Copyright 2018 New Vector Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
cwe
CWE-79
Python
htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) { const xmlChar *q; xmlChar *ret = NULL; if (CUR == '"') { NEXT; q = CUR_PTR; while ((IS_CHAR_CH(CUR)) && (CUR != '"')) NEXT; if (!IS_CHAR_CH(CUR)) { htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, "Unfinished SystemLiteral\n", NULL, ...
cwe
CWE-416
Unknown
def _dynarray_make_setter(dst, src): assert isinstance(src.typ, DArrayType) assert isinstance(dst.typ, DArrayType) if src.value == "~empty": return IRnode.from_list(STORE(dst, 0)) if src.value == "multi": ret = ["seq"] # handle literals # write the length word ...
cwe
CWE-119
Python
function main() { if (window.parent != null && window.parent.Editor != null) { if (window.parent.Editor.useLocalStorage) { document.body.innerHTML = ''; var div = document.createElement('div'); div.style.fontFamily = 'Arial'; var darkMode = typeof window.parent.Editor.isDarkMode === 'function' && ...
cwe
CWE-94
JavaScript
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */ #include <assert.h> #include <inttypes.h> #include <string.h> #include <sys/queue.h> #include <openssl/rand.h> #include "lsquic.h" #include "lsquic_int_types.h" #include "lsquic_hash.h" #include "lsquic_conn.h" #include "lsquic_packet_common.h"...
cwe
CWE-476
C/C++
protected Response attachToPost(Long messageKey, String filename, InputStream file, HttpServletRequest request) { //load message Message mess = fom.loadMessage(messageKey); if(mess == null) { return Response.serverError().status(Status.NOT_FOUND).build(); } if(!forum.equalsByPersistableKey(mess.getForum()...
cwe
CWE-23
Java
int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) { MOVMuxContext *mov = s->priv_data; AVIOContext *pb = s->pb; MOVTrack *trk = &mov->tracks[pkt->stream_index]; AVCodecParameters *par = trk->par; unsigned int samples_in_chunk = 0; int size = pkt->size, ret = 0; uint8_t *reformatted_...
cwe
CWE-369
C/C++
static bool tight_can_send_png_rect(VncState *vs, int w, int h) { if (vs->tight.type != VNC_ENCODING_TIGHT_PNG) { return false; } if (ds_get_bytes_per_pixel(vs->ds) == 1 || vs->clientds.pf.bytes_per_pixel == 1) { return false; } return true; }
cwe
CWE-125
C/C++
static Image *ReadTIFFImage(const ImageInfo *image_info, ExceptionInfo *exception) { #define ThrowTIFFException(severity,message) \ { \ if (pixel_info != (MemoryInfo *) NULL) \ pixel_info=RelinquishVirtualMemory(pixel_info); \ if (quantum_info != (QuantumInfo *) NULL) \ quantum_info=DestroyQuantumInfo(qua...
cwe
CWE-703
C/C++
ins_compl_add( char_u *str, int len, char_u *fname, char_u **cptext, // extra text for popup menu or NULL typval_T *user_data UNUSED, // "user_data" entry or NULL int cdir, int flags_arg, int adup) // accept duplicate match { compl_T *match; int dir = (cdir == 0 ? comp...
cwe
CWE-122
C/C++
def update_theory_base(tag, link): theory = sqlite3.connect(os.path.abspath(os.path.dirname(__file__)) + "\\theory.db") conn = theory.cursor() conn.execute("insert into " + str(tag) + " values (?)", (str(link), )) theory.commit() theory.close()
cwe
CWE-89
Python
// SPDX-License-Identifier: GPL-2.0 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/errno.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/smp.h> #include <linux/prctl.h> #include <linux/slab.h> #include <linux/sched.h> #include <linux/sched/idle.h> #include <linux/sched/debug.h> #include...
cwe
CWE-276
Go
static int do_io_accounting(struct task_struct *task, char *buffer, int whole) { struct task_io_accounting acct = task->ioac; unsigned long flags; if (whole && lock_task_sighand(task, &flags)) { struct task_struct *t = task; task_io_accounting_add(&acct, &task->signal->ioac); while_each_thread(task, t)...
cwe
CWE-264
C/C++
#include "common/http/conn_manager_utility.h" #include <atomic> #include <cstdint> #include <string> #include "envoy/type/v3/percent.pb.h" #include "common/common/empty_string.h" #include "common/common/utility.h" #include "common/http/conn_manager_config.h" #include "common/http/header_utility.h" #include "common/h...
cwe
CWE-22
C/C++
int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, Error **err) { FILE *fh; int fd; int64_t ret = -1, handle; if (!has_mode) { mode = "r"; } slog("guest-file-open called, filepath: %s, mode: %s", path, mode); fh = fopen(path, mode); if (!fh) { ...
cwe
CWE-264
Unknown
// Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Windows cryptographically secure pseudorandom number // generator. package rand import ( "internal/syscall/windows" "os" ) func init() { Reader = &rngRe...
cwe
CWE-835
Go
static int aio_prep_rw(struct kiocb *req, const struct iocb *iocb) { int ret; req->ki_filp = fget(iocb->aio_fildes); if (unlikely(!req->ki_filp)) return -EBADF; req->ki_complete = aio_complete_rw; req->private = NULL; req->ki_pos = iocb->aio_offset; req->ki_flags = iocb_flags(req->ki_filp); if (iocb->aio_fla...
cwe
CWE-416
Unknown
s32 hevc_parse_slice_segment(GF_BitStream *bs, HEVCState *hevc, HEVCSliceInfo *si) { u32 i, j; u32 num_ref_idx_l0_active = 0, num_ref_idx_l1_active = 0; HEVC_PPS *pps; HEVC_SPS *sps; s32 pps_id; Bool RapPicFlag = GF_FALSE; Bool IDRPicFlag = GF_FALSE; si->first_slice_segment_in_pic_flag = gf_bs_read_int_log(bs,...
cwe
CWE-190
C/C++
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String urlParam = request.getParameter("url"); if (checkUrlParameter(urlParam)) { // build the UML source from the compressed request parameter String ref = request.getHeader("referer")...
cwe
CWE-918
JavaScript
function(k){this.actions.get("shapes").funct();mxEvent.consume(k)}));c.appendChild(e);return c};EditorUi.prototype.handleError=function(c,e,g,k,m,q,v){var x=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},A=null!=c&&null!=c.error?c.error:c;if(null!=c&&("1"==urlParams.test||null!=c.stack)&...
cwe
CWE-20
JavaScript
/* * i8042 keyboard and mouse controller driver for Linux * * Copyright (c) 1999-2004 Vojtech Pavlik */ /* * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #define pr_fmt...
cwe
CWE-476
C/C++
int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp) { struct sctp_association *asoc = sctp_id2assoc(sk, id); struct sctp_sock *sp = sctp_sk(sk); struct socket *sock; int err = 0; if (!asoc) return -EINVAL; /* If there is a thread waiting on more sndbuf space for * sending on t...
cwe
CWE-416
Unknown
bool f2fs_init_extent_tree(struct inode *inode, struct f2fs_extent *i_ext) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct extent_tree *et; struct extent_node *en; struct extent_info ei; if (!f2fs_may_extent_tree(inode)) { /* drop largest extent */ if (i_ext && i_ext->len) { i_ext->len = 0; return...
cwe
CWE-787
Unknown
const bootbox = require('bootbox'); require('../services/Requisitions'); const RequisitionNode = require('../model/RequisitionNode'); const RequisitionMetaDataEntry = require('../model/RequisitionMetaDataEntry'); /** * @author Alejandro Galue <agalue@opennms.org> * @copyright 2014 The OpenNMS Group, Inc. */ (functi...
cwe
CWE-79
Java
static int mbochs_probe(struct mdev_device *mdev) { const struct mbochs_type *type = &mbochs_types[mdev_get_type_group_id(mdev)]; struct device *dev = mdev_dev(mdev); struct mdev_state *mdev_state; int ret = -ENOMEM; if (type->mbytes + mbochs_used_mbytes > max_mbytes) return -ENOMEM; mdev_state = kzalloc(si...
cwe
CWE-200
Unknown
const got = require('@/utils/got'); const cheerio = require('cheerio'); const { art } = require('@/utils/render'); const path = require('path'); module.exports = async (ctx) => { const username = ctx.params.username; const products = ctx.params.products; const url = `https://${username}.gumroad.com/l/${pro...
cwe
CWE-918
JavaScript
def resource_form(params, request, session) if not allowed_for_local_cluster(session, Permissions::READ) return 403, 'Permission denied' end cib_dom = get_cib_dom(session) @cur_resource = get_resource_by_id(params[:resource], cib_dom) @groups = get_resource_groups(cib_dom) @version = params[:version] ...
cwe
CWE-384
Ruby
ja.isResolved));F||ja.isLocked||0!=V||R(ja.isResolved?mxResources.get("reopen"):mxResources.get("resolve"),function(T){function Q(){var Z=T.target;Z.innerHTML="";ja.isResolved=!ja.isResolved;mxUtils.write(Z,ja.isResolved?mxResources.get("reopen"):mxResources.get("resolve"));for(var na=ja.isResolved?"none":"",va=ia(ja)....
cwe
CWE-94
JavaScript
static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) { struct tun_struct *tun; struct tun_file *tfile = file->private_data; struct net_device *dev; int err; if (tfile->detached) return -EINVAL; dev = __dev_get_by_name(net, ifr->ifr_name); if (dev) { if (ifr->ifr_flags & IFF_TUN_EXC...
cwe
CWE-476
C/C++
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
cwe
CWE-617
Python
// Copyright (C) 2016 University of Dundee & Open Microscopy Environment. // All rights reserved. // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // ...
cwe
CWE-79
Python
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
cwe
CWE-191
Python
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2005-2022 * All rights reserved * * This file is part of GPAC / LASeR codec sub-project * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser Gene...
cwe
CWE-189
C/C++
GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode, GfxColorSpace *colorSpaceA) { GfxIndexedColorSpace *indexedCS; GfxSeparationColorSpace *sepCS; int maxPixel, indexHigh; Guchar *lookup2; Function *sepFunc; Object obj; double x[gfxColorMaxComps]; double y[gfxColorMaxComps]; int i, j,...
cwe
CWE-189
C/C++
static Image *ReadSIXELImage(const ImageInfo *image_info,ExceptionInfo *exception) { char *sixel_buffer; Image *image; MagickBooleanType status; register char *p; register ssize_t x; register Quantum *q; size_t length; ssize_t i, j, y; unsigned char ...
cwe
CWE-399
Unknown
static u32 apic_get_tmcct(struct kvm_lapic *apic) { ktime_t remaining; s64 ns; u32 tmcct; ASSERT(apic != NULL); /* if initial count is 0, current count should also be 0 */ if (kvm_apic_get_reg(apic, APIC_TMICT) == 0) return 0; remaining = hrtimer_get_remaining(&apic->lapic_timer.timer); if (ktime_to_ns(rem...
cwe
CWE-189
C/C++
LibRaw_byte_buffer *LibRaw_abstract_datastream::make_byte_buffer(unsigned int sz) { LibRaw_byte_buffer *ret = new LibRaw_byte_buffer(sz); read(ret->get_buffer(),sz,1); return ret; }
cwe
CWE-703
Unknown
/* * Copyright (c) 2019-2021 GeyserMC. http://geysermc.org * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy,...
cwe
CWE-287
Java
public function activate_address() { global $db, $user; $object = new stdClass(); $object->id = $this->params['id']; $db->setUniqueFlag($object, 'addresses', $this->params['is_what'], "user_id=" . $user->id); flash("message", gt("Successfully updated address.")); exp...
cwe
CWE-89
PHP
private int mget(struct magic_set *ms, const unsigned char *s, struct magic *m, size_t nbytes, size_t o, unsigned int cont_level, int mode, int text, int flip, int recursion_level, int *printed_something, int *need_separator, int *returnval) { uint32_t soffset, offset = ms->offset; uint32_t count = m->str...
cwe
CWE-755
C/C++
var exec = require('child_process').exec; module.exports = function (iface, callback) { exec("cat /sys/class/net/" + iface + "/address", function (err, out) { if (err) { callback(err, null); return; } callback(null, out.trim().toLowerCase()); }); };
cwe
CWE-77
Java
/** * Copyright (c) 2006-2012, JGraph Ltd */ /** * Editor constructor executed on page load. */ Editor = function(chromeless, themes, model, graph, editable) { mxEventSource.call(this); this.chromeless = (chromeless != null) ? chromeless : this.chromeless; this.initStencilRegistry(); this.graph = graph || this....
cwe
CWE-79
JavaScript
document.createElement("link");N.setAttribute("rel","preload");N.setAttribute("href",T);N.setAttribute("as","font");N.setAttribute("crossorigin","");E.parentNode.insertBefore(N,E)}}}};Editor.trimCssUrl=function(u){return u.replace(RegExp("^[\\s\"']+","g"),"").replace(RegExp("[\\s\"']+$","g"),"")};Editor.GOOGLE_FONTS="h...
cwe
CWE-20
JavaScript
static ssize_t environ_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { char *page; unsigned long src = *ppos; int ret = 0; struct mm_struct *mm = file->private_data; unsigned long env_start, env_end; if (!mm) return 0; page = (char *)__get_free_page(GFP_TEMPORARY); if (!page...
cwe
CWE-362
C/C++
void CertManager::setPeerX509(X509* x) { if (x == 0) return; X509_NAME* issuer = x->GetIssuer(); X509_NAME* subject = x->GetSubject(); ASN1_STRING* before = x->GetBefore(); ASN1_STRING* after = x->GetAfter(); peerX509_ = NEW_YS X509(issuer->GetName(), issuer->GetLength(), subject->...
cwe
CWE-254
Unknown
public void testMatchOperations() { JWKMatcher matcher = new JWKMatcher.Builder().keyOperations(new LinkedHashSet<>(Arrays.asList(KeyOperation.SIGN, KeyOperation.VERIFY))).build(); assertTrue(matcher.matches(new RSAKey.Builder(new Base64URL("n"), new Base64URL("e")).keyID("1") .keyOperations(new HashSet<>(Arra...
cwe
CWE-347
Java
/* ** proc.c - Proc class ** ** See Copyright Notice in mruby.h */ #include <mruby.h> #include <mruby/class.h> #include <mruby/proc.h> #include <mruby/opcode.h> #include <mruby/data.h> #include <mruby/presym.h> #include <mruby/array.h> #include <mruby/hash.h> static const mrb_code call_iseq[] = { OP_CALL, }; stati...
cwe
CWE-122
C/C++
static int compare_tree_entry(struct tree_desc *t1, struct tree_desc *t2, const char *base, int baselen, struct diff_options *opt) { unsigned mode1, mode2; const char *path1, *path2; const unsigned char *sha1, *sha2; int cmp, pathlen1, pathlen2; sha1 = tree_entry_extract(t1, &path1, &mode1); sha2 = tree_entry_ex...
cwe
CWE-119
Unknown
/* * mapi_attr.c -- Functions for handling MAPI attributes * * Copyright (C)1999-2006 Mark Simpson <damned@theworld.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2...
cwe
CWE-125
C/C++
static int kvm_set_guest_paused(struct kvm_vcpu *vcpu) { if (!vcpu->arch.time_page) return -EINVAL; vcpu->arch.pvclock_set_guest_stopped_request = true; kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); return 0; }
cwe
CWE-399
Unknown
FLAC__bool find_metadata_(FLAC__StreamDecoder *decoder) { FLAC__uint32 x; unsigned i, id; FLAC__bool first = true; FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)); for(i = id = 0; i < 4; ) { if(decoder->private_->cached) { x = (FLAC__uint32)decoder->private_->lookahead; d...
cwe
CWE-119
C/C++
static int ext4_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata) { struct inode *inode = mapping->host; int ret, needed_blocks; handle_t *handle; int retries = 0; struct page *page; pgoff_t index; unsigned fr...
cwe
CWE-703
Unknown