code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
static int
xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt,
xmlXPathStepOpPtr op,
xmlNodeSetPtr set,
int contextSize,
int minPos,
int maxPos,
int hasNsNodes)
{
if (op->ch1 != -1) {
xmlXPathCompExprPtr comp = ctxt->comp;
if (comp->step... | cwe | CWE-416 | C/C++ |
TfLiteStatus SoftmaxEval(TfLiteContext* context, TfLiteNode* node) {
auto* params = reinterpret_cast<TfLiteSoftmaxParams*>(node->builtin_data);
SoftmaxOpData* data = reinterpret_cast<SoftmaxOpData*>(node->user_data);
const TfLiteTensor* input = GetInput(context, node, 0);
TfLiteTensor* output = GetOutput(conte... | cwe | CWE-787 | C/C++ |
function showTooltip(pos, item, formater) {
var content = formater(item);
$('<div id="flot-tooltip">' + content + '</div>').css({
top: pos.pageY - 40,
left: pos.pageX -10,
'border-color': item.series.color
}).appendTo("body").zIndex(5000).show();
} | cwe | CWE-79 | JavaScript |
UINT cliprdr_read_format_list(wStream* s, CLIPRDR_FORMAT_LIST* formatList, BOOL useLongFormatNames)
{
UINT32 index;
size_t position;
BOOL asciiNames;
int formatNameLength;
char* szFormatName;
WCHAR* wszFormatName;
UINT32 dataLen = formatList->dataLen;
CLIPRDR_FORMAT* formats = NULL;
UINT error = CHANNEL_RC_OK;... | cwe | CWE-125 | C/C++ |
const ResearchDAO = require("../data/research-dao").ResearchDAO;
const needle = require("needle");
const {
environmentalScripts
} = require("../../config/config");
function ResearchHandler(db) {
"use strict";
const researchDAO = new ResearchDAO(db);
this.displayResearch = (req, res) => {
if ... | cwe | CWE-404 | JavaScript |
static void dispatch_bin_command(conn *c) {
int protocol_error = 0;
int extlen = c->binary_header.request.extlen;
int keylen = c->binary_header.request.keylen;
uint32_t bodylen = c->binary_header.request.bodylen;
if (settings.sasl && !authenticated(c)) {
write_bin_error(c, PROTOCOL_BINARY_... | cwe | CWE-190 | Unknown |
static ssize_t sync_state_only_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct device_link *link = to_devlink(dev);
return sprintf(buf, "%d\n", !!(link->flags & DL_FLAG_SYNC_STATE_ONLY));
} | cwe | CWE-787 | Unknown |
static gboolean irssi_ssl_verify(SSL *ssl, SSL_CTX *ctx, X509 *cert)
{
if (SSL_get_verify_result(ssl) != X509_V_OK) {
unsigned char md[EVP_MAX_MD_SIZE];
unsigned int n;
char *str;
g_warning("Could not verify SSL servers certificate:");
if ((str = X509_NAME_oneline(X509_get_subject_name(cert), 0, 0)) == N... | cwe | CWE-20 | C/C++ |
/*-
* Copyright (c) 2004-2013 Tim Kientzle
* Copyright (c) 2011-2012,2014 Michihiro NAKAJIMA
* Copyright (c) 2013 Konrad Kleine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redi... | cwe | CWE-399 | C/C++ |
/* Copyright 2019 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-476 | Python |
static char *print_value( cJSON *item, int depth, int fmt )
{
char *out = 0;
if ( ! item )
return 0;
switch ( ( item->type ) & 255 ) {
case cJSON_NULL: out = cJSON_strdup( "null" ); break;
case cJSON_False: out = cJSON_strdup( "false" ); break;
case cJSON_True: out = cJSON_strdup( "true" ); break;
cas... | cwe | CWE-120 | C/C++ |
/*
* Digital Signature Service Protocol Project.
* Copyright (C) 2016 e-Contract.be BVBA.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version
* 3.0 as published by the Free Software Foundation.
*
* This software is distributed in... | cwe | CWE-611 | Java |
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 initialize(){destroy();if(!window.Clipboard){pasteCatcher=document.createElement('div');pasteCatcher.id='screenshot-pastezone';pasteCatcher.contentEditable=!0;pasteCatcher.style.opacity=0;pasteCatcher.style.position='fixed';pasteCatcher.style.top=0;pasteCatcher.style.right=0;pasteCatcher.style.width=0;document... | cwe | CWE-79 | JavaScript |
static DnsServer* dns_server_free(DnsServer *s) {
assert(s);
dns_stream_unref(s->stream);
#if ENABLE_DNS_OVER_TLS
dnstls_server_free(s);
#endif
free(s->server_string);
return mfree(s);
} | cwe | CWE-416 | Unknown |
static int tight_fill_palette(VncState *vs, int x, int y,
size_t count, uint32_t *bg, uint32_t *fg,
VncPalette **palette)
{
int max;
max = count / tight_conf[vs->tight.compression].idx_max_colors_divisor;
if (max < 2 &&
count >= tight_conf... | cwe | CWE-120 | C/C++ |
PyObject *PyString_DecodeEscape(const char *s,
Py_ssize_t len,
const char *errors,
Py_ssize_t unicode,
const char *recode_encoding)
{
int c;
char *p, *buf;
const char *end;
PyO... | cwe | CWE-190 | C/C++ |
/*
* This file is part of NetSurf's LibNSGIF, http://www.netsurf-browser.org/
* Licensed under the MIT License,
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2017 Michael Drake <michael.drake@codethink.co.uk>
*/
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#incl... | cwe | CWE-787 | C/C++ |
def custom_login(request, **kwargs):
# Currently, Django 1.5 login view does not redirect somewhere if the user is logged in
if request.user.is_authenticated:
return redirect(request.GET.get('next', request.user.st.get_absolute_url()))
if request.method == "POST" and request.is_limited():
r... | cwe | CWE-601 | Python |
package config
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"time"
"github.com/BurntSushi/toml"
"github.com/mitchellh/go-homedir"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
prefixed "github.com/x-cray/logrus-prefixed-formatter"
"github.com/stripe... | cwe | CWE-78 | Go |
static js_Ast *memberexp(js_State *J)
{
js_Ast *a;
INCREC();
a = newexp(J);
loop:
if (jsP_accept(J, '.')) { a = EXP2(MEMBER, a, identifiername(J)); goto loop; }
if (jsP_accept(J, '[')) { a = EXP2(INDEX, a, expression(J, 0)); jsP_expect(J, ']'); goto loop; }
DECREC();
... | cwe | CWE-674 | 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-754 | C/C++ |
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright 2021 Google LLC.
*/
#include <linux/init.h>
#include <linux/highmem.h>
#include <linux/kobject.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/vmalloc.h>
#include "internal.h"
static int ... | cwe | CWE-476 | C/C++ |
bool PermissionsData::CanCaptureVisiblePage(int tab_id,
std::string* error) const {
const URLPattern all_urls(URLPattern::SCHEME_ALL,
URLPattern::kAllUrlsPattern);
base::AutoLock auto_lock(runtime_lock_);
if (active_permissions_unsafe_... | cwe | CWE-20 | C/C++ |
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a comme... | cwe | CWE-79 | Go |
static int walk_hugetlb_range(unsigned long addr, unsigned long end,
struct mm_walk *walk)
{
struct vm_area_struct *vma = walk->vma;
struct hstate *h = hstate_vma(vma);
unsigned long next;
unsigned long hmask = huge_page_mask(h);
unsigned long sz = huge_page_size(h);
pte_t *pte;
int err = 0;
do {
... | cwe | CWE-200 | C/C++ |
function validateAuthToken(meetingId, requesterUserId, requesterToken) {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'ValidateAuthTokenReqMsg';
const sessionId = `${meetingId}--${requesterUserId}`;
this.setUserId(sessionId);
cons... | cwe | CWE-74 | JavaScript |
@staticmethod
def _create_database(engine: "Engine", db: Text):
"""Create database `db` on `engine` if it does not exist."""
import psycopg2
conn = engine.connect()
cursor = conn.connection.cursor()
cursor.execute("COMMIT")
cursor.execute(f"SELECT 1 FROM pg_catalog... | cwe | CWE-89 | Python |
hostkey_method_ssh_ecdsa_init(LIBSSH2_SESSION * session,
const unsigned char *hostkey_data,
size_t hostkey_data_len,
void **abstract)
{
libssh2_ecdsa_ctx *ecdsactx = NULL;
const unsigned char *s, *k;
size_t len, key_len, n_len;
... | cwe | CWE-787 | Unknown |
public String createEmbedJavaScript(HttpServletRequest request)
throws IOException
{
String sparam = request.getParameter("s");
String dev = request.getParameter("dev");
StringBuffer result = new StringBuffer("[");
StringBuffer js = new StringBuffer("");
// Processes each stencil only once
HashSet<Stri... | cwe | CWE-918 | JavaScript |
process_bitmap_updates(STREAM s)
{
uint16 num_updates;
uint16 left, top, right, bottom, width, height;
uint16 cx, cy, bpp, Bpp, compress, bufsize, size;
uint8 *data, *bmpdata;
int i;
logger(Protocol, Debug, "%s()", __func__);
in_uint16_le(s, num_updates);
for (i = 0; i < num_updates; i++)
{
in_uint16_le(s... | cwe | CWE-787 | Unknown |
AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
AP4_UI32 type,
AP4_UI32 size_32,
AP4_UI64 size_64,
AP4_Atom*& atom)
{
bool ... | cwe | CWE-476 | Unknown |
DefaultResetPasswordRequestResponse(UserReference reference, InternetAddress userEmail, String verificationCode)
{
this.userReference = reference;
this.userEmail = userEmail;
this.verificationCode = verificationCode;
} | cwe | CWE-200 | Java |
const BlockEntry* Segment::GetBlock(const CuePoint& cp,
const CuePoint::TrackPosition& tp) {
Cluster** const ii = m_clusters;
Cluster** i = ii;
const long count = m_clusterCount + m_clusterPreloadCount;
Cluster** const jj = ii + count;
Cluster** j = jj;
while (i < j) {
Cluster** const k = i + (j - i) / 2;
... | cwe | CWE-20 | C/C++ |
void AppControllerImpl::LaunchApp(const std::string& app_id) {
app_service_proxy_->Launch(app_id, ui::EventFlags::EF_NONE,
apps::mojom::LaunchSource::kFromAppListGrid,
display::kDefaultDisplayId);
} | cwe | CWE-416 | C/C++ |
static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value,
BN_GENCB *cb)
{
BIGNUM *r0 = NULL, *r1 = NULL, *r2 = NULL, *r3 = NULL, *tmp;
int bitsp, bitsq, ok = -1, n = 0;
BN_CTX *ctx = NULL;
unsigned long error = 0;
/*
* When generating ridiculously small k... | cwe | CWE-327 | Unknown |
def _migrate_map(contents):
# Find the first non-header line
lines = contents.splitlines(True)
i = 0
while _is_header_line(lines[i]):
i += 1
header = ''.join(lines[:i])
rest = ''.join(lines[i:])
if isinstance(ordered_load(contents), list):
# If they are using the "default" ... | cwe | CWE-502 | Python |
function A(ha,qa,aa,ca,na){na||(da.innerHTML="",K(),T=ha,X=ca);var la=null;if(aa){la=document.createElement("table");
la.className="geTempDlgDiagramsListGrid";var oa=document.createElement("tr"),ra=document.createElement("th");ra.style.width="50%";ra.innerHTML=mxUtils.htmlEntities(mxResources.get("diagram"));oa.appendC... | cwe | CWE-94 | JavaScript |
GC_API GC_ATTR_MALLOC void * GC_CALL GC_calloc_explicitly_typed(size_t n,
size_t lb, GC_descr d)
{
word *op;
size_t lg;
GC_descr simple_descr;
complex_descriptor *complex_descr;
int descr_type;
struct LeafDescriptor leaf;
GC_ASSERT(GC_... | cwe | CWE-119 | Unknown |
R_API RBinJavaAnnotation *r_bin_java_annotation_new(ut8 *buffer, ut64 sz, ut64 buf_offset) {
ut32 i = 0;
RBinJavaAnnotation *annotation = NULL;
RBinJavaElementValuePair *evps = NULL;
ut64 offset = 0;
annotation = R_NEW0 (RBinJavaAnnotation);
if (!annotation) {
return NULL;
}
// (ut16) read and set annotation_... | cwe | CWE-119 | C/C++ |
static int mount_autodev(const char *name, const struct lxc_rootfs *rootfs, const char *lxcpath)
{
int ret;
size_t clen;
char *path;
INFO("Mounting container /dev");
/* $(rootfs->mount) + "/dev/pts" + '\0' */
clen = (rootfs->path ? strlen(rootfs->mount) : 0) + 9;
path = alloca(clen);
ret = snprintf(path, cle... | cwe | CWE-59 | C/C++ |
__acquires(kernel_lock)
{
char *orig_data = kstrdup(data, GFP_KERNEL);
struct buffer_head *bh;
struct ext4_super_block *es = NULL;
struct ext4_sb_info *sbi;
ext4_fsblk_t block;
ext4_fsblk_t sb_block = get_sb_block(&data);
ext4_fsblk_t logical_sb_block;
unsigned long offset = 0;
unsigned long journal_devnum = 0... | cwe | CWE-703 | Unknown |
static int em28xx_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct usb_device *udev;
struct em28xx *dev = NULL;
int retval;
bool has_vendor_audio = false, has_video = false, has_dvb = false;
int i, nr, try_bulk;
const int ifnum = intf->altsetting[0].desc.bInterfaceNumber;
cha... | cwe | CWE-416 | C/C++ |
/*
* Copyright (c) 2009-2012, Salvatore Sanfilippo <antirez at gmail dot com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above co... | cwe | CWE-680 | C/C++ |
BOOL nsc_process_message(NSC_CONTEXT* context, UINT16 bpp,
UINT32 width, UINT32 height,
const BYTE* data, UINT32 length,
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStride,
UINT32 nXDst, UINT32 ... | cwe | CWE-787 | Unknown |
_PUBLIC_ codepoint_t next_codepoint_handle_ext(
struct smb_iconv_handle *ic,
const char *str, size_t len,
charset_t src_charset,
size_t *bytes_consumed)
{
/* it cannot occupy more than 4 bytes in UTF16 format */
uint8_t buf[4];
smb_iconv_t descriptor;
size_t ilen_orig;
size_t ilen;
size_t olen;... | cwe | CWE-200 | Unknown |
bytesPerLineTable (const Header &header,
vector<size_t> &bytesPerLine)
{
const Box2i &dataWindow = header.dataWindow();
const ChannelList &channels = header.channels();
bytesPerLine.resize (dataWindow.max.y - dataWindow.min.y + 1);
for (ChannelList::ConstIterator c = channels.begin();
c != chan... | cwe | CWE-125 | Unknown |
unique_ptr<IOBuf> IOBuf::createCombined(std::size_t capacity) {
// To save a memory allocation, allocate space for the IOBuf object, the
// SharedInfo struct, and the data itself all with a single call to malloc().
size_t requiredStorage = offsetof(HeapFullStorage, align) + capacity;
size_t mallocSize = goodMal... | cwe | CWE-787 | Unknown |
static void flush_tx_queue(struct tty_struct *tty)
{
struct n_hdlc *n_hdlc = tty2n_hdlc(tty);
struct n_hdlc_buf *buf;
unsigned long flags;
while ((buf = n_hdlc_buf_get(&n_hdlc->tx_buf_list)))
n_hdlc_buf_put(&n_hdlc->tx_free_buf_list, buf);
spin_lock_irqsave(&n_hdlc->tx_buf_list.spinlock, flags);
if (n_hdlc->t... | cwe | CWE-362 | 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-94 | JavaScript |
static int dev_get_valid_name(struct net *net,
struct net_device *dev,
const char *name)
{
BUG_ON(!net);
if (!dev_valid_name(name))
return -EINVAL;
if (strchr(name, '%'))
return dev_alloc_name_ns(net, dev, name);
else if (__dev_get_by_name(net, name))
return -EEXIST;
else if (dev->name... | cwe | CWE-476 | C/C++ |
static void xmlGROW (xmlParserCtxtPtr ctxt) {
unsigned long curEnd = ctxt->input->end - ctxt->input->cur;
unsigned long curBase = ctxt->input->cur - ctxt->input->base;
if (((curEnd > (unsigned long) XML_MAX_LOOKUP_LIMIT) ||
(curBase > (unsigned long) XML_MAX_LOOKUP_LIMIT)) &&
((ctxt->inpu... | cwe | CWE-119 | Unknown |
int __mdiobus_register(struct mii_bus *bus, struct module *owner)
{
struct mdio_device *mdiodev;
int i, err;
struct gpio_desc *gpiod;
if (NULL == bus || NULL == bus->name ||
NULL == bus->read || NULL == bus->write)
return -EINVAL;
BUG_ON(bus->state != MDIOBUS_ALLOCATED &&
bus->state != MDIOBUS_UNR... | cwe | CWE-416 | C/C++ |
GF_Err SFScript_Parse(GF_BifsDecoder *codec, SFScript *script_field, GF_BitStream *bs, GF_Node *n)
{
GF_Err e;
u32 i, count, nbBits;
char *ptr;
ScriptParser parser;
e = GF_OK;
if (gf_node_get_tag(n) != TAG_MPEG4_Script) return GF_NON_COMPLIANT_BITSTREAM;
parser.codec = codec;
parser.script = n;
parser.bs = bs... | cwe | CWE-476 | Unknown |
def search
selectTerm = "id, name, info_one, info_one_red, info_two, info_two_red, info_three, info_three_red, updated_at, last_user, avatar_upload, updated_at";
whereSearchTerm = "name LIKE '%#{params[:query]}%'"
whereSearchTerm += "OR description LIKE '%#{params[:query]}%'"
whereSearchTerm += "OR info_one... | cwe | CWE-89 | Ruby |
getDownloadUrl(fileId, accessToken) {
return `${Shopware.Context.api.apiPath}/_action/${this.getApiBasePath()}/` +
`file/download?fileId=${fileId}&accessToken=${accessToken}`;
} | cwe | CWE-639 | JavaScript |
"url": url.toString(),
"async": (typeof async !== "boolean" ? true : async),
"user": user || null,
"password": password || null
};
setState(this.OPENED);
};
/**
* Disables or enables isAllowedHttpHeader() check the request. Enabled by default.
* This does not conform to the W3C spe... | cwe | CWE-295 | JavaScript |
get_uncompressed_data(struct archive_read *a, const void **buff, size_t size,
size_t minimum)
{
struct _7zip *zip = (struct _7zip *)a->format->data;
ssize_t bytes_avail;
if (zip->codec == _7Z_COPY && zip->codec2 == (unsigned long)-1) {
/* Copy mode. */
/*
* Note: '1' here is a performance optimizatio... | cwe | CWE-125 | C/C++ |
rsa_sec_decrypt(const struct rsa_public_key *pub,
const struct rsa_private_key *key,
void *random_ctx, nettle_random_func *random,
size_t length, uint8_t *message,
const mpz_t gibberish)
{
TMP_GMP_DECL (m, mp_limb_t);
TMP_GMP_DECL (em, uint8_t);
int res;
TMP_GMP_ALLOC (m, mp... | cwe | CWE-20 | Unknown |
static struct vm_area_struct *vma_to_resize(unsigned long addr,
unsigned long old_len, unsigned long new_len, unsigned long *p)
{
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma = find_vma(mm, addr);
if (!vma || vma->vm_start > addr)
goto Efault;
if (is_vm_hugetlb_page(vma))
goto Einval;
/* ... | cwe | CWE-189 | C/C++ |
static struct bio *bio_copy_kern(struct request_queue *q, void *data,
unsigned int len, gfp_t gfp_mask, int reading)
{
unsigned long kaddr = (unsigned long)data;
unsigned long end = (kaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT;
unsigned long start = kaddr >> PAGE_SHIFT;
struct bio *bio;
void *p = data;
int nr_pa... | cwe | CWE-200 | Unknown |
/*
Copyright (c) 2014, Yahoo! Inc. All rights reserved.
Copyrights licensed under the New BSD License.
See the accompanying LICENSE file for terms.
*/
'use strict';
// Generate an internal UID to make the regexp pattern harder to guess.
var UID = Math.floor(Math.random() * 0x10000000000).toString(16);... | cwe | CWE-74 | JavaScript |
md(str, opt = {}) {
this._state = {};
str = this._xmlEscape(str);
str = this._nbsp(str);
if (!opt.raw) str = this._mdLink(str);
if (!opt.raw) str = this._plainUrlToLink(str);
if (!opt.raw) str = this._extendedFormatting(str);
if (!opt.raw) str = this._mdCode(str);
if (!opt.raw) str = thi... | cwe | CWE-79 | JavaScript |
'use strict';
const request = require('request');
/**
* A default set of user agent patterns for bots/crawlers that do not perform
* well with pages that require JavaScript.
*/
const botUserAgents = module.exports.botUserAgents = [
'W3C_Validator',
'baiduspider',
'bingbot',
'embedly',
'facebookexternalhi... | cwe | CWE-284 | JavaScript |
# -*- test-case-name: twisted.web.test.test_static -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Static resources for L{twisted.web}.
"""
import errno
import itertools
import mimetypes
import os
import time
import warnings
from html import escape
from typing import Any, Callable, Di... | cwe | CWE-79 | Python |
static void Sp_replace_regexp(js_State *J)
{
js_Regexp *re;
const char *source, *s, *r;
js_Buffer *sb = NULL;
int n, x;
Resub m;
source = checkstring(J, 0);
re = js_toregexp(J, 1);
if (js_regexec(re->prog, source, &m, 0)) {
js_copy(J, 0);
return;
}
re->last = 0;
loop:
s = m.sub[0].sp;
n = m.sub[0].e... | cwe | CWE-674 | Unknown |
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This 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 version 2.1 of
* th... | cwe | CWE-863 | Java |
accept_ice_connection (GIOChannel *source,
GIOCondition condition,
GsmIceConnectionData *data)
{
IceListenObj listener;
IceConn ice_conn;
IceAcceptStatus status;
GsmClient *client;
GsmXsmpServer *se... | cwe | CWE-835 | Unknown |
static Jsi_Value *jsi_treeFmtKey(Jsi_MapEntry* h, struct Jsi_MapOpts *opts, int flags)
{
Jsi_TreeEntry* hPtr = (Jsi_TreeEntry*)h;
void *key = Jsi_TreeKeyGet(hPtr);
if (opts->keyType == JSI_KEYS_ONEWORD)
return Jsi_ValueNewNumber(opts->interp, (Jsi_Number)(intptr_t)key);
char nbuf[100];
snpri... | cwe | CWE-120 | C/C++ |
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "sym... | cwe | CWE-400 | Java |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2019-2021
* All rights reserved
*
* This file is part of GPAC / FLAC reframer filter
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General... | cwe | CWE-787 | C/C++ |
// Start OpenPGP.js Import
/*! OpenPGP.js v4.10.10 - 2021-01-24 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}e... | cwe | CWE-347 | JavaScript |
/*
Copyright (c) 2014. The YARA Authors. All Rights Reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the followi... | cwe | CWE-125 | C/C++ |
void ValidateInputs(OpKernelContext* ctx,
const CSRSparseMatrix& sparse_matrix,
const Tensor& permutation_indices, int* batch_size,
int64* num_rows) {
OP_REQUIRES(ctx, sparse_matrix.dtype() == DataTypeToEnum<T>::value,
errors::Invalid... | cwe | CWE-476 | C/C++ |
static MagickPixelPacket **AcquirePixelThreadSet(const Image *image)
{
MagickPixelPacket
**pixels;
register ssize_t
i,
j;
size_t
number_threads;
number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
pixels=(MagickPixelPacket **) AcquireQuantumMemory(number_threads,
s... | cwe | CWE-787 | C/C++ |
zsetcolor(i_ctx_t * i_ctx_p)
{
os_ptr op = osp;
es_ptr ep;
const gs_color_space * pcs = gs_currentcolorspace(igs);
gs_client_color cc;
int n_comps, n_numeric_comps, num_offset = 0, code, depth;
PS_colour_space_t *space;
/* initialize the client ... | cwe | CWE-704 | C/C++ |
"""A class representing a container for serializing and deserializing a list of
private keys, as well as the metadata needed to encrypt and decrypt private
bytes.
"""
import base64
import collections
import getpass
import secrets
import types
import typing
import warnings
from openssh_key import utils
from openssh_ke... | cwe | CWE-209 | Python |
static bool getCoverageFormat12(vector<uint32_t>& coverage, const uint8_t* data, size_t size) {
const size_t kNGroupsOffset = 12;
const size_t kFirstGroupOffset = 16;
const size_t kGroupSize = 12;
const size_t kStartCharCodeOffset = 0;
const size_t kEndCharCodeOffset = 4;
const size_t kMaxNGroups = 0xfffffff0 / k... | cwe | CWE-20 | C/C++ |
int kvm_iommu_unmap_guest(struct kvm *kvm)
{
struct iommu_domain *domain = kvm->arch.iommu_domain;
/* check if iommu exists and in use */
if (!domain)
return 0;
kvm_iommu_unmap_memslots(kvm);
iommu_domain_free(domain);
return 0;
} | cwe | CWE-264 | Unknown |
EditorUi.prototype.createUi=function(){this.menubar=this.editor.chromeless?null:this.menus.createMenubar(this.createDiv("geMenubar"));null!=this.menubar&&this.menubarContainer.appendChild(this.menubar.container);null!=this.menubar&&(this.statusContainer=this.createStatusContainer(),this.editor.addListener("statusChange... | cwe | CWE-94 | JavaScript |
int CLASS ljpeg_start (struct jhead *jh, int info_only)
{
int c, tag, len;
uchar data[0x10000];
const uchar *dp;
memset (jh, 0, sizeof *jh);
jh->restart = INT_MAX;
fread (data, 2, 1, ifp);
if (data[1] != 0xd8) return 0;
do {
fread (data, 2, 2, ifp);
tag = data[0] << 8 | data[1];
len = (dat... | cwe | CWE-189 | Unknown |
xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
{
xmlCharEncodingHandlerPtr handler;
int len = -1;
if (ctxt == NULL) return(-1);
switch (enc) {
case XML_CHAR_ENCODING_ERROR:
__xmlErrEncoding(ctxt, XML_ERR_UNKNOWN_ENCODING,
"encoding unknown\n", NULL, NULL);
... | cwe | CWE-119 | Unknown |
static int fprintf_mtab_fs(FILE *f, struct libmnt_fs *fs)
{
char *o;
char *m1, *m2, *m3, *m4;
int rc;
assert(fs);
assert(f);
o = mnt_fs_strdup_options(fs);
if (!o)
return -ENOMEM;
m1 = mangle(mnt_fs_get_source(fs));
m2 = mangle(mnt_fs_get_target(fs));
m3 = mangle(mnt_fs_get_fstype(fs));
m4 = mangle(o);
... | cwe | CWE-399 | Unknown |
package com.salesmanager.shop.admin.controller.customers;
import com.salesmanager.core.business.services.customer.CustomerService;
import com.salesmanager.core.business.services.customer.attribute.CustomerAttributeService;
import com.salesmanager.core.business.services.customer.attribute.CustomerOptionService;
import ... | cwe | CWE-639 | Java |
static void mcf_fec_do_tx(mcf_fec_state *s)
{
uint32_t addr;
mcf_fec_bd bd;
int frame_size;
int len;
uint8_t frame[FEC_MAX_FRAME_SIZE];
uint8_t *ptr;
DPRINTF("do_tx\n");
ptr = frame;
frame_size = 0;
addr = s->tx_descriptor;
while (1) {
mcf_fec_read_bd(&bd, addr);
... | cwe | CWE-399 | Unknown |
static int __poke_user_compat(struct task_struct *child,
addr_t addr, addr_t data)
{
struct user32 *dummy32 = NULL;
per_struct32 *dummy_per32 = NULL;
__u32 tmp = (__u32) data;
addr_t offset;
if (addr < (addr_t) &dummy32->regs.acrs) {
/*
* psw, gprs, acrs and orig_gpr2 are stored on the stack
*/
... | cwe | CWE-399 | Unknown |
content: function() {
return $( this ).attr( "title" );
}, | cwe | CWE-79 | JavaScript |
/*
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
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, m... | cwe | CWE-476 | C/C++ |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
OpData* data = reinterpret_cast<OpData*>(node->user_data);
const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1);
const TfLiteTensor... | cwe | CWE-787 | C/C++ |
protected function emailExistsInDB($email)
{
/* Build sql query*/
$sql = 'SELECT * FROM '.$this->usersTable;
$sql .= ' WHERE email = "'.$email.'";';
/* Execute query */
$results = $this->wiki->loadAll($sql);
return $results; // If the password does not already exist ... | cwe | CWE-89 | PHP |
nfs4_callback_svc(void *vrqstp)
{
int err;
struct svc_rqst *rqstp = vrqstp;
set_freezable();
while (!kthread_should_stop()) {
/*
* Listen for a request on the socket
*/
err = svc_recv(rqstp, MAX_SCHEDULE_TIMEOUT);
if (err == -EAGAIN || err == -EINTR)
continue;
svc_process(rqstp);
}
re... | cwe | CWE-404 | C/C++ |
ShouldCancelAndIgnore(NavigationHandle* handle) {
return handle->GetFrameTreeNodeId() == frame_tree_node_id_;
} | cwe | CWE-362 | C/C++ |
static ssize_t driver_override_show(struct device *_dev,
struct device_attribute *attr, char *buf)
{
struct amba_device *dev = to_amba_device(_dev);
return sprintf(buf, "%s\n", dev->driver_override);
} | cwe | CWE-415 | C/C++ |
def zmi_page_request(self, *args, **kwargs):
request = self.REQUEST
RESPONSE = request.RESPONSE
SESSION = request.SESSION
self._zmi_page_request()
RESPONSE.setHeader('Expires',DateTime(request['ZMI_TIME']-10000).toZone('GMT+1').rfc822())
RESPONSE.setHeader('Cache-Control', 'no-cache'... | cwe | CWE-22 | Python |
int ip_check_mc_rcu(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u8 proto)
{
struct ip_mc_list *im;
struct ip_mc_list __rcu **mc_hash;
struct ip_sf_list *psf;
int rv = 0;
mc_hash = rcu_dereference(in_dev->mc_hash);
if (mc_hash) {
u32 hash = hash_32((__force u32)mc_addr, MC_HASH_SZ_LOG);
for (i... | cwe | CWE-362 | C/C++ |
function escapeArgBash(arg, interpolation, quoted) {
let result = arg.replace(/\u0000/g, "");
if (interpolation) {
result = result
.replace(/\\/g, "\\\\")
.replace(/\n/g, " ")
.replace(/(^|\s)(~|#)/g, "$1\\$2")
.replace(/(\*|\?)/g, "\\$1")
.replace(/(\$|\;|\&|\|)/g, "\\$1")
... | cwe | CWE-1333 | JavaScript |
async function applyMermaid(element, key = "composer") {
const mermaids = element.querySelectorAll("pre[data-code-wrap=mermaid]");
if (!mermaids.length) {
return;
}
await loadScript(settings.theme_uploads_local.mermaid_js);
window.mermaid.initialize({
startOnLoad: false,
theme:
getCompute... | cwe | CWE-74 | JavaScript |
status_t DRMSource::read(MediaBuffer **buffer, const ReadOptions *options) {
Mutex::Autolock autoLock(mDRMLock);
status_t err;
if ((err = mOriginalMediaSource->read(buffer, options)) != OK) {
return err;
}
size_t len = (*buffer)->range_length();
char *src = (char *)(*buffer)->data() + (*buffer)->range_offset()... | cwe | CWE-119 | C/C++ |
/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.
This file is part of Quake III Arena source code.
Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
publish... | cwe | CWE-254 | C/C++ |
public function save(){
$login_user = $this->checkLogin();
$team_name = I("team_name");
$id = I("id/d");
if ($id) {
D("Team")->where(" id = '$id' ")->save(array("team_name"=>$team_name));
}else{
$data['username'] = $login_user['username'] ;... | cwe | CWE-352 | PHP |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.