code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
_PyMemoTable_ResizeTable(PyMemoTable *self, Py_ssize_t min_size) { PyMemoEntry *oldtable = NULL; PyMemoEntry *oldentry, *newentry; Py_ssize_t new_size = MT_MINSIZE; Py_ssize_t to_process; assert(min_size > 0); /* Find the smallest valid table size >= min_size. */ while (new_size < min_size...
cwe
CWE-190
C/C++
package io.hawt.web.plugin.karaf.terminal; import org.apache.felix.service.command.CommandProcessor; import org.apache.felix.service.command.CommandSession; import org.apache.felix.service.threadio.ThreadIO; import org.apache.karaf.shell.console.jline.Console; import org.slf4j.Logger; import org.slf4j.LoggerFactory; ...
cwe
CWE-287
Java
static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda) { struct gfs2_sbd *sdp = (*qda)->qd_gl->gl_sbd; struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode); unsigned int data_blocks, ind_blocks; struct gfs2_holder *ghs, i_gh; unsigned int qx, x; struct gfs2_quota_data *qd; loff_t offset; unsigned ...
cwe
CWE-399
Unknown
r.HandleFunc("/api/diffs/last/{num}", func(w http.ResponseWriter, r *http.Request) { // Grab vars vars := mux.Vars(r) var output string // This is bad... don't do this.... omg query := fmt.Sprintf(`SELECT json_agg(r) FROM (select EXTRACT(epoch FROM day) as day, up_count, down_count, finished_count from trell...
cwe
CWE-89
Go
def load(input, *options) input.respond_to?(:write) or return open(input, 'r') { |io| load(io, *options) } opthash = { :format => :yaml, :session => false, } case options.size when 0 when 1 case options = options.first when Symbol op...
cwe
CWE-78
Ruby
/** * Copyright (c) 2006-2020, JGraph Ltd * Copyright (c) 2006-2020, draw.io AG */ (function() { // Adds scrollbars for menus that exceed the page height var mxPopupMenuShowMenu = mxPopupMenu.prototype.showMenu; mxPopupMenu.prototype.showMenu = function() { this.div.style.overflowY = 'auto'; this.div.style.o...
cwe
CWE-78
JavaScript
def fetch_file(self, in_path, out_path): ''' fetch a file from chroot to local ''' if not in_path.startswith(os.path.sep): in_path = os.path.join(os.path.sep, in_path) normpath = os.path.normpath(in_path) in_path = os.path.join(self.chroot, normpath[1:]) vvv("FETCH ...
cwe
CWE-59
Python
int usb_get_bos_descriptor(struct usb_device *dev) { struct device *ddev = &dev->dev; struct usb_bos_descriptor *bos; struct usb_dev_cap_header *cap; unsigned char *buffer; int length, total_len, num, i; int ret; bos = kzalloc(sizeof(struct usb_bos_descriptor), GFP_KERNEL); if (!bos) return -ENOMEM; /* Get...
cwe
CWE-125
C/C++
int init_aliases(void) { FILE *fp; char alias[MAXALIASLEN + 1U]; char dir[PATH_MAX + 1U]; if ((fp = fopen(ALIASES_FILE, "r")) == NULL) { return 0; } while (fgets(alias, sizeof alias, fp) != NULL) { if (*alias == '#' || *alias == '\n' || *alias == 0) { continue; ...
cwe
CWE-824
C/C++
static void *pvrdma_map_to_pdir(PCIDevice *pdev, uint64_t pdir_dma, uint32_t nchunks, size_t length) { uint64_t *dir, *tbl; int tbl_idx, dir_idx, addr_idx; void *host_virt = NULL, *curr_page; if (!nchunks) { rdma_error_report("Got nchunks=0"); return NULL...
cwe
CWE-787
Unknown
ikev2_ID_print(netdissect_options *ndo, u_char tpay, const struct isakmp_gen *ext, u_int item_len _U_, const u_char *ep _U_, uint32_t phase _U_, uint32_t doi _U_, uint32_t proto _U_, int depth _U_) { struct ikev2_id id; int id_len, idtype_len, i; unsigned int dumpascii, dumphex; const unsigned char *typedat...
cwe
CWE-125
C/C++
spnego_gss_init_sec_context( OM_uint32 *minor_status, gss_cred_id_t claimant_cred_handle, gss_ctx_id_t *context_handle, gss_name_t target_name, gss_OID mech_type, OM_uint32 req_flags, OM_uint32 time_req, gss_channel_bindings_t input_chan_bindings, gss_buffer_t input_token, gss_OID *actual_...
cwe
CWE-763
C/C++
package com.salesmanager.shop.filter; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;...
cwe
CWE-639
Java
int64_t LineBasedFrameDecoder::findEndOfLine(IOBufQueue& buf) { Cursor c(buf.front()); for (uint32_t i = 0; i < maxLength_ && i < buf.chainLength(); i++) { auto b = c.read<char>(); if (b == '\n' && terminatorType_ != TerminatorType::CARRIAGENEWLINE) { return i; } else if (terminatorType_ != Termin...
cwe
CWE-787
C/C++
function RegistrationSaveContactNameFields( $config, $values ) { if ( empty( $values['FIRST_NAME'] ) || empty( $values['LAST_NAME'] ) ) { return 0; } $person_id = DBSeqNextID( 'people_person_id_seq' ); $sql = "INSERT INTO PEOPLE "; $fields = 'PERSON_ID,LAST_NAME,FIRST_NAME,MIDDLE_NAME,'; $values_sql = "'...
cwe
CWE-89
PHP
struct ipv6_txoptions *ipv6_update_options(struct sock *sk, struct ipv6_txoptions *opt) { if (inet_sk(sk)->is_icsk) { if (opt && !((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) && inet_sk(sk)->inet_daddr != LOOPBACK4_IPV6) { struct inet_connection_sock *icsk = inet_csk(sk); icsk->icsk_e...
cwe
CWE-416
Unknown
void faad_resetbits(bitfile *ld, int bits) { uint32_t tmp; int words = bits >> 5; int remainder = bits & 0x1F; ld->bytes_left = ld->buffer_size - words*4; if (ld->bytes_left >= 4) { tmp = getdword(&ld->start[words]); ld->bytes_left -= 4; } else { tmp = getdword_n(&l...
cwe
CWE-119
Unknown
$('#modalExport .btn-primary').on('click', function (e) { e.preventDefault(); var elBtn = $(this), bid = $('#modalExport input[name=exportGroupBy]:checked').val(), url = listId + '/export' + (bid ? '/' + bid : ''); elBtn.attr('href', url); ...
cwe
CWE-79
JavaScript
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % ...
cwe
CWE-772
C/C++
export const redirectAnyRequest = response => { const {headers: {location}} = Response.message (response); const original = Response.request (response); const oldUrl = Request.url (original); const newUrl = mergeUrls (oldUrl) (location); return (Request (Request.options (original)) (newUrl) ...
cwe
CWE-212
JavaScript
/******************************************************************************* * This file is part of OpenNMS(R). * * Copyright (C) 2002-2014 The OpenNMS Group, Inc. * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * * OpenNMS(...
cwe
CWE-79
Java
/* eslint-disable no-shadow, no-invalid-this */ /* global vm, host, Contextify, Decontextify, VMError, options */ 'use strict'; const {Script} = host.require('vm'); const fs = host.require('fs'); const pa = host.require('path'); const BUILTIN_MODULES = host.process.binding('natives'); const parseJSON = JSON.parse; c...
cwe
CWE-915
JavaScript
int dsdb_user_obj_set_primary_group_id(struct ldb_context *ldb, struct ldb_message *usr_obj, uint32_t user_account_control, uint32_t *group_rid_p) { int ret; uint32_t rid; struct ldb_message_element *el; rid = ds_uf2prim_group_rid(user_account_control); ret = samdb_msg_add_uint(ldb, usr_obj, usr_obj, ...
cwe
CWE-200
Unknown
static unsigned int xdr_set_page_base(struct xdr_stream *xdr, unsigned int base, unsigned int len) { unsigned int pgnr; unsigned int maxlen; unsigned int pgoff; unsigned int pgend; void *kaddr; maxlen = xdr->buf->page_len; if (base >= maxlen) { base = maxlen; maxlen = 0; } else maxlen -= base; ...
cwe
CWE-119
C/C++
/** * Copyright (c) 2006-2016, JGraph Ltd */ /** * No CSS and resources available in embed mode. Parameters and docs: * https://www.diagrams.net/doc/faq/embed-html-options */ GraphViewer = function(container, xmlNode, graphConfig) { this.init(container, xmlNode, graphConfig); }; // Editor inherits from mxEventSo...
cwe
CWE-79
JavaScript
void create_empty_file_as_root(const char *fname, mode_t mode) { assert(fname); mode &= 07777; struct stat s; if (stat(fname, &s)) { if (arg_debug) printf("Creating empty %s file\n", fname); /* coverity[toctou] */ // don't fail if file already exists. This can be the case in a race // condition, when tw...
cwe
CWE-269
Unknown
int HttpFileImpl::save(const std::string &path) const { assert(!path.empty()); if (fileName_.empty()) return -1; filesystem::path fsPath(utils::toNativePath(path)); if (!fsPath.is_absolute() && (!fsPath.has_parent_path() || (fsPath.begin()->string() != "." && fsPath.begin()->str...
cwe
CWE-552
C/C++
brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_ap_settings *settings) { s32 ie_offset; struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct brcmf_if *ifp = netdev_priv(ndev); const struct brcmf_tlv *ssid_ie; const struct brcmf_tlv *country_ie; struct brcmf_ssid_l...
cwe
CWE-119
C/C++
/* ** io.c - IO class */ #include "mruby.h" #include "mruby/array.h" #include "mruby/class.h" #include "mruby/data.h" #include "mruby/hash.h" #include "mruby/string.h" #include "mruby/variable.h" #include "mruby/ext/io.h" #if MRUBY_RELEASE_NO < 10000 #include "error.h" #else #include "mruby/error.h" #endif #include ...
cwe
CWE-416
C/C++
INLINE void gdi_RectToCRgn(const HGDI_RECT rect, INT32* x, INT32* y, INT32* w, INT32* h) { *x = rect->left; *y = rect->top; *w = rect->right - rect->left + 1; *h = rect->bottom - rect->top + 1; }
cwe
CWE-190
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-665
Python
/* package providers is a catch-all for all TAP auth provider types (e.g. social, active directory), if you are extending TAP to use more providers, add them to this section */ package providers import ( "crypto/tls" "encoding/json" "errors" "fmt" "net/http" "strings" "sync" "github.com/go-ldap/ldap/v3" "git...
cwe
CWE-287
Go
/* Copyright (c) 2009-2018 Roger Light <roger@atchoo.org> All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 and Eclipse Distribution License v1.0 which accompany this distribution. The Eclipse Public License is available at http:/...
cwe
CWE-732
C/C++
GLboolean WebGL2RenderingContextBase::isTransformFeedback( WebGLTransformFeedback* feedback) { if (isContextLost() || !feedback) return 0; if (!feedback->HasEverBeenBound()) return 0; return ContextGL()->IsTransformFeedback(feedback->Object()); }
cwe
CWE-787
C/C++
function addMenu(id, small, img) { var menu = ui.menus.get(id); var elt = menuObj.addMenu(mxResources.get(id), mxUtils.bind(this, function() { // Allows extensions of menu.functid menu.funct.apply(this, arguments); }), before); elt.className = (urlParams['sketch'] == '1') ? 'geToo...
cwe
CWE-94
JavaScript
/* * Copyright (c) 2015. David Sowerby * * 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 agreed to in wri...
cwe
CWE-89
Java
static int gaff_init(struct hid_device *hid) { struct gaff_device *gaff; struct hid_report *report; struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list); struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list; struct list_head *report_ptr = report_lis...
cwe
CWE-787
C/C++
struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off, const struct bpf_insn *patch, u32 len) { u32 insn_adj_cnt, insn_rest, insn_delta = len - 1; struct bpf_prog *prog_adj; /* Since our patchlet doesn't expand the image, we're done. */ if (insn_delta == 0) { memcpy(prog->insnsi + off,...
cwe
CWE-120
C/C++
pdf14_open(gx_device *dev) { pdf14_device *pdev = (pdf14_device *)dev; gs_int_rect rect; if_debug2m('v', dev->memory, "[v]pdf14_open: width = %d, height = %d\n", dev->width, dev->height); rect.p.x = 0; rect.p.y = 0; rect.q.x = dev->width; rect.q.y = dev->height; pdev->ctx...
cwe
CWE-416
Unknown
/** * Copyright (c) 2006-2017, JGraph Ltd * Copyright (c) 2006-2017, Gaudenz Alder */ (function() { /** * Version */ EditorUi.VERSION = '@DRAWIO-VERSION@'; /** * Overrides compact UI setting. */ EditorUi.compactUi = uiTheme != 'atlas'; /** * Overrides default grid color for dark mode */ if (Edit...
cwe
CWE-284
Java
// mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go package unix import "syscall" const ( B1000000 ...
cwe
CWE-287
Go
package com.salesmanager.shop.admin.model.web; import java.util.List; import com.salesmanager.core.model.system.MerchantConfiguration; public class ConfigListWrapper { private List<MerchantConfiguration> merchantConfigs; public List<MerchantConfiguration> getMerchantConfigs() { return merchantConfigs; } p...
cwe
CWE-639
Java
bool SiteInstanceImpl::DoesSiteRequireDedicatedProcess( BrowserContext* browser_context, const GURL& url) { if (SiteIsolationPolicy::UseDedicatedProcessesForAllSites()) return true; if (url.SchemeIs(kChromeErrorScheme)) return true; GURL site_url = SiteInstance::GetSiteForURL(browser_contex...
cwe
CWE-119
C/C++
package com.datformers.servlet; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.sql.ResultSet; import java.util.Formatter; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServle...
cwe
CWE-89
Java
/* * Copyright 2016 Red Hat, Inc. and/or its affiliates * and other contributors as indicated by the @author tags. * * 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.apach...
cwe
CWE-798
Java
int hns_ppe_get_sset_count(int stringset) { if (stringset == ETH_SS_STATS) return ETH_PPE_STATIC_NUM; return 0; }
cwe
CWE-703
Unknown
nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd3_readargs *args) { unsigned int len; int v; u32 max_blocksize = svc_max_payload(rqstp); p = decode_fh(p, &args->fh); if (!p) return 0; p = xdr_decode_hyper(p, &args->offset); args->count = ntohl(*p++); len = min(args->count, max...
cwe
CWE-404
C/C++
int fscrypt_setup_filename(struct inode *dir, const struct qstr *iname, int lookup, struct fscrypt_name *fname) { int ret = 0, bigname = 0; memset(fname, 0, sizeof(struct fscrypt_name)); fname->usr_fname = iname; if (!dir->i_sb->s_cop->is_encrypted(dir) || fscrypt_is_dot_dotdot(iname)) { fname->dis...
cwe
CWE-476
Unknown
/* * util.c: utility functions used by OpenSC command line tools. * * Copyright (C) 2011 OpenSC Project developers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * versi...
cwe
CWE-119
C/C++
package server import ( "github.com/labstack/echo/v4" "github.com/usememos/memos/api" "github.com/usememos/memos/common" ) type response struct { Data interface{} `json:"data"` } func composeResponse(data interface{}) response { return response{ Data: data, } } func (server *Server) DefaultAuthSkipper(c ech...
cwe
CWE-79
Go
import dayjs from 'dayjs' import utc from 'dayjs/plugin/utc' import { saveAs } from 'file-saver' import { FlowRouter } from 'meteor/ostrio:flow-router-extra' import { NullXlsx } from '@neovici/nullxlsx' import './periodtimetable.html' import './pagination.js' import './limitpicker.js' import { i18nReady, t } from '../....
cwe
CWE-79
JavaScript
package io.swagger.client; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.client.Invocation; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.Form; import javax.ws.rs.core.GenericType; import javax.ws.rs.core.MediaType; import...
cwe
CWE-732
Java
/******************************************************************************* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this...
cwe
CWE-209
Java
hfs_cat_traverse(HFS_INFO * hfs, TSK_HFS_BTREE_CB a_cb, void *ptr) { TSK_FS_INFO *fs = &(hfs->fs_info); uint32_t cur_node; /* node id of the current node */ char *node; uint16_t nodesize; uint8_t is_done = 0; tsk_error_reset(); nodesize = tsk_getu16(fs->endian, hfs->catalog_h...
cwe
CWE-125
Unknown
def next @mutex.synchronize { @id += 1 } end
cwe
CWE-20
Ruby
#include "webcc/server.h" #include <csignal> #include <fstream> #include <utility> #include "webcc/body.h" #include "webcc/logger.h" #include "webcc/request.h" #include "webcc/response.h" #include "webcc/utility.h" using namespace std::placeholders; using tcp = boost::asio::ip::tcp; namespace webcc { // NOTE: // U...
cwe
CWE-22
C/C++
delete_buff_tail(buffheader_T *buf, int slen) { int len = (int)STRLEN(buf->bh_curr->b_str); if (len >= slen) { buf->bh_curr->b_str[len - slen] = NUL; buf->bh_space += slen; } }
cwe
CWE-125
C/C++
SilenceMessage(const std::string& mask, const std::string& flags) : ClientProtocol::Message("SILENCE") { PushParam(mask); PushParamRef(flags); }
cwe
CWE-416
C/C++
GF_Err xtra_box_read(GF_Box *s, GF_BitStream *bs) { GF_XtraBox *ptr = (GF_XtraBox *)s; while (ptr->size) { GF_XtraTag *tag; u32 prop_type = 0; char *data=NULL, *data2=NULL; ISOM_DECREASE_SIZE_NO_ERR(ptr, 8) s32 tag_size = gf_bs_read_u32(bs); u32 name_size = gf_bs_read_u32(bs); if (tag_size < 8) return ...
cwe
CWE-787
Unknown
static _Bool have_gcrypt (void) /* {{{ */ { static _Bool result = 0; static _Bool need_init = 1; if (!need_init) return (result); need_init = 0; #if HAVE_LIBGCRYPT # if GCRYPT_VERSION_NUMBER < 0x010600 gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); # endif if (!gcry_check_version (GCRY...
cwe
CWE-119
Unknown
*/ int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) { if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= (unsigned int)sk->sk_rcvbuf) return -ENOMEM; skb_orphan(skb); skb->sk = sk; skb->destructor = sock_rmem_free; atomic_add(skb->truesize, &sk->sk_rmem_alloc); /* before exiting rcu secti...
cwe
CWE-125
Unknown
static int ssl3_get_record(SSL *s) { int ssl_major,ssl_minor,al; int enc_err,n,i,ret= -1; SSL3_RECORD *rr; SSL_SESSION *sess; unsigned char *p; unsigned char md[EVP_MAX_MD_SIZE]; short version; unsigned mac_size; int clear=0; size_t extra; rr= &(s->s3->rrec); sess=s->session; if (s->options & SSL_OP_MIC...
cwe
CWE-310
Unknown
static char *expandRequestTokens(HttpConn *conn, char *str) { HttpRx *rx; HttpTx *tx; HttpRoute *route; MprBuf *buf; HttpLang *lang; char *tok, *cp, *key, *value, *field, *header, *defaultValue, *state, *v, *p; assert(conn); assert(str); rx = conn->rx; ...
cwe
CWE-476
C/C++
String.prototype.escapeHTML = function(){ /* HTML Escape Before Inserting Untrusted Data into HTML Element Content https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention _Cheat_Sheet#RULE_.231_-_HTML_Escape_Before_Inserting_Untrusted_Data_into _HTML_Element_Content */ var ...
cwe
CWE-79
JavaScript
def audit audit_args.parse Homebrew.auditing = true inject_dump_stats!(FormulaAuditor, /^audit_/) if args.audit_debug? formula_count = 0 problem_count = 0 corrected_problem_count = 0 new_formula_problem_count = 0 new_formula = args.new_formula? strict = new_formula || args.strict? ...
cwe
CWE-78
Ruby
def to_ods(self, *selection): if not ODFLIB_INSTALLED: raise ODFLIBNotInstalled(_('odfpy not installed.')) if self.fcn_list: stat_list = self.fcn_list[:] order_text = " Ordered by: " + self.sort_type + '\n' else: stat_list = self.stats.keys() ...
cwe
CWE-377
Python
package com.salesmanager.shop.admin.model.customer.attribute; import java.io.Serializable; import com.salesmanager.shop.model.entity.ShopEntity; public class CustomerOptionValue extends ShopEntity implements Serializable { /** * */ private static final long serialVersionUID = 1L; private String name; p...
cwe
CWE-79
Java
CHAT_DCC_REC *dcc_chat_create(IRC_SERVER_REC *server, CHAT_DCC_REC *chat, const char *nick, const char *arg) { CHAT_DCC_REC *dcc; dcc = g_new0(CHAT_DCC_REC, 1); dcc->orig_type = dcc->type = DCC_CHAT_TYPE; dcc->mirc_ctcp = settings_get_bool("dcc_mirc_ctcp"); dcc->id = dcc_chat_get_new_id(n...
cwe
CWE-416
Unknown
void operator()(OpKernelContext* ctx, bool use_cudnn, bool cudnn_use_autotune, const Tensor& input, const Tensor& filter, int row_dilation, int col_dilation, int row_stride, int col_stride, const Padding& padding, const std::vector<int64>& explicit...
cwe
CWE-369
Unknown
_handleMeta: function(message, local, callback, context) { var method = Channel.parse(message.channel)[1], response; if (array.indexOf(this.META_METHODS, method) < 0) { response = this._makeResponse(message); response.error = Error.channelForbidden(message.channel); response.successfu...
cwe
CWE-287
Ruby
/*- * Copyright 2014 Square Inc. * * 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 agreed to...
cwe
CWE-190
Go
var pageJSisDone = body.waitForJS ? false : true; page.viewportSize = { width: body.viewportSize.width || 600, height: body.viewportSize.height || 600 }; page.settings.javascriptEnabled = body.settings.javascriptEnabled !== false; page.settings.resourceTimeout = body.settings.resourceTimeout || 10000; if(bo...
cwe
CWE-200
JavaScript
func(ctx etreeutils.NSContext, signedInfo *etree.Element) error { detachedSignedInfo, err := etreeutils.NSDetatch(ctx, signedInfo) if err != nil { return err } c14NMethod, err := etreeutils.NSFindOneChildCtx(ctx, detachedSignedInfo, Namespace, CanonicalizationMethodTag) if err != nil { re...
cwe
CWE-347
Go
static int read_public_key(RSA *rsa) { int r; sc_path_t path; sc_file_t *file; u8 buf[2048], *p = buf; size_t bufsize, keysize; r = select_app_df(); if (r) return 1; sc_format_path("I1012", &path); r = sc_select_file(card, &path, &file); if (r) { fprintf(stderr, "Unable to select public key file: %s\n", ...
cwe
CWE-415
Unknown
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2019, Evgeniy Krysanov <evgeniy.krysanov@gmail.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = r''' --- mo...
cwe
CWE-532
Python
from django.contrib import admin from import_export.admin import ImportExportModelAdmin from import_export.fields import Field from import_export.resources import ModelResource import import_export.widgets as widgets from build.models import Build, BuildItem import part.models class BuildResource(ModelResource): ...
cwe
CWE-434
Python
/* * Copyright 2012 The Netty Project * * The Netty Project licenses this file to you 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: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless...
cwe
CWE-668
Java
gnutls_session_get_data (gnutls_session_t session, void *session_data, size_t * session_data_size) { gnutls_datum_t psession; int ret; if (session->internals.resumable == RESUME_FALSE) return GNUTLS_E_INVALID_SESSION; psession.data = session_data; ret = _gnutls_session_pack (s...
cwe
CWE-119
Unknown
function handleLegacyMultipartApi (handler, done, opts) { if (typeof handler !== 'function') { throw new Error('handler must be a function') } if (typeof done !== 'function') { throw new Error('the callback must be a function') } if (!this.isMultipart()) { done(new Error('the req...
cwe
CWE-1321
JavaScript
# -*- coding: utf-8 -*- # Copyright (c) 2015, Frappe Technologies and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document class PortalSettings(Document): def add_item(self, item): '''insert new portal menu i...
cwe
CWE-79
Python
MagickExport MagickBooleanType EqualizeImage(Image *image, ExceptionInfo *exception) { #define EqualizeImageTag "Equalize/Image" CacheView *image_view; double black[CompositePixelChannel+1], *equalize_map, *histogram, *map, white[CompositePixelChannel+1]; MagickBooleanType status...
cwe
CWE-787
C/C++
// Copyright 2009,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. // OpenBSD system calls. // This file is compiled as ordinary Go code, // but it is also input to mksyscall, // which parses the //sys lines and generates ...
cwe
CWE-287
Go
miniflow_extract(struct dp_packet *packet, struct miniflow *dst) { const struct pkt_metadata *md = &packet->md; const void *data = dp_packet_data(packet); size_t size = dp_packet_size(packet); ovs_be32 packet_type = packet->packet_type; uint64_t *values = miniflow_values(dst); struct mf_ctx mf =...
cwe
CWE-400
Unknown
/* * Copyright (C) Alexander Borisov * Copyright (C) Nginx, Inc. */ #include <njs_main.h> typedef enum { NJS_PROMISE_HANDLE = 0, NJS_PROMISE_REJECT } njs_promise_rejection_type_t; typedef enum { NJS_PROMISE_ALL = 0, NJS_PROMISE_ALL_SETTLED, NJS_PROMISE_ANY } njs_promise_function_type_t; typ...
cwe
CWE-843
C/C++
public function portalAudit($type = 'insert', $rec = '', array $auditvals, $oelog = true, $error = true) { $return = false; $result = false; $audit = array (); if ($type != 'insert') { $audit['date'] = $auditvals['date'] ? $auditvals['date'] : date("Y-m-d H:i:s"); ...
cwe
CWE-22
PHP
"use strict"; // https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders const childProcess = require("child_process"), path = require("path"), fs = require("fs"), processWrapper = require("./process-wrapper"); const supportedPlatforms = [ "win32", "linux", "darwin" ]; const nodeModulesDir...
cwe
CWE-77
JavaScript
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException { int type = read(); if (type < 0) { throw new EOFException(); } switch (type) { case ThrowableObjectOutputStream.TYPE_EXCEPTION: return Object...
cwe
CWE-74
Java
static int ssl_scan_clienthello_tlsext(SSL *s, PACKET *pkt, int *al) { unsigned int type; int renegotiate_seen = 0; PACKET extensions; *al = SSL_AD_DECODE_ERROR; s->servername_done = 0; s->tlsext_status_type = -1; #ifndef OPENSSL_NO_NEXTPROTONEG s->s3->next_proto_neg_seen = 0; #endif O...
cwe
CWE-20
Unknown
h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf) { my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample; register int y, cred, cgreen, cblue; int cb, cr; register JSA...
cwe
CWE-476
Unknown
chkpass_ne(PG_FUNCTION_ARGS) { chkpass *a1 = (chkpass *) PG_GETARG_POINTER(0); text *a2 = PG_GETARG_TEXT_PP(1); char str[9]; text_to_cstring_buffer(a2, str, sizeof(str)); PG_RETURN_BOOL(strcmp(a1->password, crypt(str, a1->password)) != 0); }
cwe
CWE-119
Unknown
package main /* gophish - Open-Source Phishing Framework The MIT License (MIT) Copyright (c) 2013 Jordan Wright 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 wi...
cwe
CWE-918
Go
/* * Copyright IBM Corporation, 2010 * Author Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2.1 of the GNU Lesser General Public License * as published by the Free Software Foundation. * * This program ...
cwe
CWE-285
C/C++
function o(){var e;return"undefined"!=typeof XMLHttpRequest?e=n(8):"undefined"!=typeof process&&(e=n(8)),e}
cwe
CWE-755
JavaScript
int wasm_dis(WasmOp *op, const unsigned char *buf, int buf_len) { op->len = 1; op->op = buf[0]; if (op->op > 0xbf) return 1; // add support for extension opcodes (SIMD + atomics) WasmOpDef *opdef = &opcodes[op->op]; switch (op->op) { case WASM_OP_TRAP: case WASM_OP_NOP: case WASM_OP_ELSE: case WASM_OP_RETURN:...
cwe
CWE-125
Unknown
function vn(e){return kt(ce(e),(function(t){var n=q[t]=e[t];q.prototype[t]=function(){var e=[this._wrapped];return r.o.apply(e,arguments),An(this,n.apply(q,e))}})),q}
cwe
CWE-79
JavaScript
QPDF::resolve(int objid, int generation) { // Check object cache before checking xref table. This allows us // to insert things into the object cache that don't actually // exist in the file. QPDFObjGen og(objid, generation); if (! this->obj_cache.count(og)) { if (! this->xref_table.count(og))...
cwe
CWE-399
C/C++
static int smsusb_init_device(struct usb_interface *intf, int board_id) { struct smsdevice_params_t params; struct smsusb_device_t *dev; void *mdev; int i, rc; /* create device object */ dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL); if (!dev) return -ENOMEM; memset(&params, 0, sizeof(params)); ...
cwe
CWE-476
C/C++
public function createFromBill(Request $request, Bill $bill) { $request->session()->flash('info', (string)trans('firefly.instructions_rule_from_bill', ['name' => $bill->name])); $this->createDefaultRuleGroup(); $this->createDefaultRule(); $preFilled = [ 'strict' => ...
cwe
CWE-79
PHP
void Compute(OpKernelContext* context) override { // Input tensor is of the following dimensions: // [ batch, in_rows, in_cols, in_depth ] const Tensor& input = context->input(0); // Input filter is of the following dimensions: // [ filter_rows, filter_cols, in_depth, out_depth] const Tensor& f...
cwe
CWE-20
Unknown
void TestJlCompress::extractDir_data() { QTest::addColumn<QString>("zipName"); QTest::addColumn<QStringList>("fileNames"); QTest::newRow("simple") << "jlextdir.zip" << ( QStringList() << "test0.txt" << "testdir1/test1.txt" << "testdir2/test2.txt" << "testdir2/subdir/test2sub.txt"); ...
cwe
CWE-22
C/C++