code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
var collapsedGroups = {};
var shoppingListTable = $('#shoppinglist-table').DataTable({
'order': [[1, 'asc']],
"orderFixed": [[3, 'asc']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 },
{ 'visible': false, 'targets': 3 }
],
'rowGroup': {
dataSrc: 3,
startRen... | cwe | CWE-79 | JavaScript |
char *redisProtocolToLuaType_Aggregate(lua_State *lua, char *reply, int atype) {
char *p = strchr(reply+1,'\r');
long long mbulklen;
int j = 0;
string2ll(reply+1,p-reply-1,&mbulklen);
if (server.lua_client->resp == 2 || atype == '*') {
p += 2;
if (mbulklen == -1) {
lua_p... | cwe | CWE-787 | Unknown |
static int audit_netlink_ok(struct sk_buff *skb, u16 msg_type)
{
int err = 0;
/* Only support initial user namespace for now. */
/*
* We return ECONNREFUSED because it tricks userspace into thinking
* that audit was not configured into the kernel. Lots of users
* configure their PAM stack (because that's wha... | cwe | CWE-264 | Unknown |
PrintingContext::Result PrintingContextCairo::UpdatePrinterSettings(
const DictionaryValue& job_settings, const PageRanges& ranges) {
#if defined(OS_CHROMEOS)
bool landscape = false;
if (!job_settings.GetBoolean(kSettingLandscape, &landscape))
return OnError();
settings_.SetOrientation(landscape);
set... | cwe | CWE-416 | C/C++ |
package com.bezman.servlet;
import com.bezman.background.DailySubmission;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework... | cwe | CWE-89 | Java |
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.... | cwe | CWE-611 | Java |
static void adapter_stop(struct btd_adapter *adapter)
{
/* check pending requests */
reply_pending_requests(adapter);
cancel_passive_scanning(adapter);
remove_discovery_list(adapter);
discovery_cleanup(adapter, 0);
adapter->filtered_discovery = false;
adapter->no_scan_restart_delay = false;
g_free(adapter->... | cwe | CWE-863 | Unknown |
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
var Jupyter = Jupyter || {};
var jprop = function(name, module_path){
Object.defineProperty(Jupyter, name, {
get: function() {
console.warn('accessing `'+name+'` is deprecated. Use `requirejs("... | cwe | CWE-79 | Python |
$result[$index][1] = preg_replace(
"/" . $find . "/",
$replaceWith,
$row[0]
);
}
}
return $result;
} | cwe | CWE-94 | PHP |
static StringInfo *ParseImageResourceBlocks(Image *image,
const unsigned char *blocks,size_t length,
MagickBooleanType *has_merged_image,ExceptionInfo *exception)
{
const unsigned char
*p;
StringInfo
*profile;
unsigned char
name_length;
unsigned int
count;
unsigned short
id,
sh... | cwe | CWE-125 | C/C++ |
static ssize_t _hostsock_recv(
oe_fd_t* sock_,
void* buf,
size_t count,
int flags)
{
ssize_t ret = -1;
sock_t* sock = _cast_sock(sock_);
oe_errno = 0;
if (!sock || (count && !buf))
OE_RAISE_ERRNO(OE_EINVAL);
if (buf)
{
if (oe_memset_s(buf, count, 0, count) != O... | cwe | CWE-200 | Unknown |
WRITE_JSON_ELEMENT(ArrStart) {
/* increase depth, save: before first array entry no comma needed. */
ctx->commaNeeded[++ctx->depth] = false;
return writeChar(ctx, '[');
} | cwe | CWE-787 | Unknown |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "ESTreeIRGen.h"
#include "llvh/ADT/SmallString.h"
namespace hermes {
namespace irgen {
//===---------------------------... | cwe | CWE-125 | C/C++ |
horizontalDifference8(unsigned char *ip, int n, int stride,
unsigned short *wp, uint16 *From8)
{
register int r1, g1, b1, a1, r2, g2, b2, a2, mask;
#undef CLAMP
#define CLAMP(v) (From8[(v)])
mask = CODE_MASK;
if (n >= stride) {
if (stride == 3) {
r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(i... | cwe | CWE-787 | C/C++ |
function(c){if(null!=c[EditorUi.DIFF_INSERT])for(var e=0;e<c[EditorUi.DIFF_INSERT].length;e++)try{var g=mxUtils.parseXml(c[EditorUi.DIFF_INSERT][e].data).documentElement.cloneNode(!1);null!=g.getAttribute("name")&&g.setAttribute("name",this.anonymizeString(g.getAttribute("name")));c[EditorUi.DIFF_INSERT][e].data=mxUtil... | cwe | CWE-20 | JavaScript |
static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
AVStream *stream,
PayloadContext *h264_data,
const char *attr, const char *value)
{
AVCodecParameters *par = stream->codecpar;
if (!strcmp(... | cwe | CWE-119 | C/C++ |
def extend_volume(self, volume, new_size):
volume_name = self._get_3par_vol_name(volume['id'])
old_size = volume.size
growth_size = int(new_size) - old_size
LOG.debug("Extending Volume %s from %s to %s, by %s GB." %
(volume_name, old_size, new_size, growth_size))
... | cwe | CWE-78 | Python |
long keyctl_join_session_keyring(const char __user *_name)
{
char *name;
long ret;
/* fetch the name from userspace */
name = NULL;
if (_name) {
name = strndup_user(_name, PAGE_SIZE);
if (IS_ERR(name)) {
ret = PTR_ERR(name);
goto error;
}
}
/* join the session */
ret = join_session_keyring(name);
... | cwe | CWE-399 | Unknown |
$contents[] = ['class' => 'text-center', 'text' => tep_draw_bootstrap_button(IMAGE_SAVE, 'fas fa-save', null, 'primary', null, 'btn-success xxx text-white mr-2') . tep_draw_bootstrap_button(IMAGE_CANCEL, 'fas fa-times', tep_href_link('countries.php', 'page=' . $_GET['page']), null, null, 'btn-light')]; | cwe | CWE-79 | PHP |
_dl_dst_count (const char *name, int is_path)
{
size_t cnt = 0;
do
{
size_t len = 1;
/* $ORIGIN is not expanded for SUID/GUID programs. */
if ((((!__libc_enable_secure
&& strncmp (&name[1], "ORIGIN", 6) == 0 && (len = 7) != 0)
|| (strncmp (&name[1], "PLATFORM", 8) == 0 && (len = ... | cwe | CWE-252 | C/C++ |
int snd_card_new(struct device *parent, int idx, const char *xid,
struct module *module, int extra_size,
struct snd_card **card_ret)
{
struct snd_card *card;
int err;
if (snd_BUG_ON(!card_ret))
return -EINVAL;
*card_ret = NULL;
if (extra_size < 0)
extra_size = 0;
card = kzalloc(sizeof(*card) + e... | cwe | CWE-362 | Unknown |
def get(image_file, domain, title, singer, album):
import ast
import base64
import json
import os
from html import unescape
import requests
api = f"http://{domain}:7873/bGVhdmVfcmlnaHRfbm93"
with open(image_file, "rb") as f:
im_bytes = f.read()
f.close()
im_b64 = b... | cwe | CWE-78 | Python |
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/ory/fosite/handler/openid (interfaces: OpenIDConnectRequestStorage)
// Package internal is a generated GoMock package.
package internal
import (
context "context"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
fosite "github.com/ory/fosi... | cwe | CWE-345 | Go |
/* 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 applicable law or a... | cwe | CWE-681 | Python |
read_32 (IOBUF inp)
{
unsigned long a;
a = iobuf_get_noeof (inp) << 24;
a |= iobuf_get_noeof (inp) << 16;
a |= iobuf_get_noeof (inp) << 8;
a |= iobuf_get_noeof (inp);
return a;
} | cwe | CWE-20 | Unknown |
function ecverify (Qx, Qy, sigr, sigs, z) {
const w = invmod(sigs, N)
const u1 = mulmod(z, w, N)
const u2 = mulmod(sigr, w, N)
const Q = AtoJ(Qx, Qy)
const G = AtoJ(GX, GY)
const RinJ = ecadd(ecmul(G, u1), ecmul(Q, u2))
const r = JtoA(RinJ)
return sigr.eq(... | cwe | CWE-347 | JavaScript |
/*
* PgBouncer - Lightweight connection pooler for PostgreSQL.
*
* Copyright (c) 2007-2009 Marko Kreen, Skype Technologies OÜ
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permissi... | cwe | CWE-89 | C/C++ |
Status SetUnknownShape(const NodeDef* node, int output_port) {
shape_inference::ShapeHandle shape =
GetUnknownOutputShape(node, output_port);
InferenceContext* ctx = GetContext(node);
if (ctx == nullptr) {
return errors::InvalidArgument("Missing context");
}
ctx->set_output(output_port... | cwe | CWE-787 | C/C++ |
null_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p)
{
u_int length = h->len;
u_int caplen = h->caplen;
u_int family;
if (caplen < NULL_HDRLEN) {
ND_PRINT((ndo, "[|null]"));
return (NULL_HDRLEN);
}
memcpy((char *)&family, (const char *)p, sizeof(family));
/*
* This isn't ... | cwe | CWE-787 | Unknown |
void Compute(OpKernelContext *ctx) override {
const Tensor *a_indices_t, *a_values_t, *a_shape_t, *b_indices_t,
*b_values_t, *b_shape_t;
OP_REQUIRES_OK(ctx, ctx->input("a_indices", &a_indices_t));
OP_REQUIRES_OK(ctx, ctx->input("a_values", &a_values_t));
OP_REQUIRES_OK(ctx, ctx->input("a_shape",... | cwe | CWE-754 | C/C++ |
public void translate(ServerSettingsRequestPacket packet, GeyserSession session) {
CustomForm window = SettingsUtils.buildForm(session);
int windowId = session.getFormCache().addForm(window);
// Fixes https://bugs.mojang.com/browse/MCPE-94012 because of the delay
session.getConnector().... | cwe | CWE-287 | Java |
static ssize_t state_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct memory_block *mem = to_memory_block(dev);
ssize_t len = 0;
/*
* We can probably put these states in a nice little array
* so that they're not open-coded
*/
switch (mem->state) {
case MEM_ONLINE:
len = spr... | cwe | CWE-787 | Unknown |
/*
* random.c -- A strong random number generator
*
* Copyright (C) 2017 Jason A. Donenfeld <Jason@zx2c4.com>. All
* Rights Reserved.
*
* Copyright Matt Mackall <mpm@selenic.com>, 2003, 2004, 2005
*
* Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999. All
* rights reserved.
*
* Redistribution and ... | cwe | CWE-330 | C/C++ |
/* vi:set ts=8 sts=4 sw=4 noet:
*
* VIM - Vi IMproved by Bram Moolenaar
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
* See README.txt for an overview of the Vim source code.
*/
#include "vim.h"
/*
* Vim originated fro... | cwe | CWE-122 | C/C++ |
/*
* pkcs15-sc-hsm.c : Initialize PKCS#15 emulation
*
* Copyright (C) 2012 Andreas Schwier, CardContact, Minden, Germany
*
* 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
*... | cwe | CWE-119 | C/C++ |
void ConnPoolImplBase::closeIdleConnectionsForDrainingPool() {
// Create a separate list of elements to close to avoid mutate-while-iterating problems.
std::list<ActiveClient*> to_close;
for (auto& client : ready_clients_) {
if (client->numActiveStreams() == 0) {
to_close.push_back(client.get());
}... | cwe | CWE-674 | Unknown |
generate_ns_check(struct module_qstate* qstate, struct iter_qstate* iq, int id)
{
struct iter_env* ie = (struct iter_env*)qstate->env->modinfo[id];
struct module_qstate* subq;
log_assert(iq->dp);
if(iq->depth == ie->max_dependency_depth)
return;
if(!can_have_last_resort(qstate->env, iq->dp->name, iq->dp->namele... | cwe | CWE-400 | Unknown |
static void transit(h2_session *session, const char *action, h2_session_state nstate)
{
apr_time_t timeout;
int ostate, loglvl;
const char *s;
if (session->state != nstate) {
ostate = session->state;
session->state = nstate;
loglvl = APLOG_DEBUG;
if ((ostate... | cwe | CWE-770 | Unknown |
closure (void)
{
int tindex, ntokens, i;
atom();
while (tok == QMARK || tok == STAR || tok == PLUS || tok == REPMN)
if (tok == REPMN && (minrep || maxrep))
{
ntokens = nsubtoks(dfa->tindex);
tindex = dfa->tindex - ntokens;
if (maxrep < 0)
addtok(PLUS);
if (minr... | cwe | CWE-189 | Unknown |
static Image *ReadARTImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
Image
*image;
QuantumInfo
*quantum_info;
QuantumType
quantum_type;
MagickBooleanType
status;
size_t
length;
ssize_t
count,
y;
unsigned char
*pixels;
/*
Open image file.
*/
as... | cwe | CWE-120 | C/C++ |
static void nsc_rle_decode(BYTE* in, BYTE* out, UINT32 originalSize)
{
UINT32 len;
UINT32 left;
BYTE value;
left = originalSize;
while (left > 4)
{
value = *in++;
if (left == 5)
{
*out++ = value;
left--;
}
else if (value == *in)
{
in++;
if (*in < 0xFF)
{
len = (UINT32) *... | cwe | CWE-787 | C/C++ |
static void* swoole_unserialize_object(void *buffer, zval *return_value, zend_uchar bucket_len, zval *args, long flag)
{
zval property;
uint32_t arr_num = 0;
size_t name_len = *((unsigned short*) buffer);
if (!name_len)
{
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "illegal unserialize data")... | cwe | CWE-502 | Unknown |
/* $Id$ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
*
* 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; eit... | cwe | CWE-120 | C/C++ |
static int parse_part_sign_sha256(sockent_t *se, /* {{{ */
void **ret_buffer, size_t *ret_buffer_len,
int flags) {
static c_complain_t complain_no_users = C_COMPLAIN_INIT_STATIC;
char *buffer;
size_t buffer_len;
size_t buffer_offset;
size_t... | cwe | CWE-835 | C/C++ |
/**
* @file
* A Backbone Model for the state of an in-place editable entity in the DOM.
*/
(function (_, $, Backbone, Drupal) {
Drupal.quickedit.EntityModel = Drupal.quickedit.BaseModel.extend(
/** @lends Drupal.quickedit.EntityModel# */ {
/**
* @type {object}
*/
defaults: /** @lends... | cwe | CWE-352 | Python |
import namedavatar from 'namedavatar'
import { i18nReady, t } from './i18n.js'
import { Globalsettings } from '../api/globalsettings/globalsettings.js'
const clientTimecards = new Mongo.Collection('clientTimecards')
function getGlobalSetting(name) {
return Globalsettings.findOne({ name }) ? Globalsettings.findOne({... | cwe | CWE-1236 | JavaScript |
/*-
* Copyright (c) 2017 Martin Matuska
* 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 cond... | cwe | CWE-59 | C/C++ |
function smarty_function_math($params, $template)
{
static $_allowed_funcs =
array(
'int' => true,
'abs' => true,
'ceil' => true,
'cos' => true,
'exp' => true,
'floor' => true,
'log' => true,
'log10' =... | cwe | CWE-74 | PHP |
/******************************************************************************
*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
* ... | cwe | CWE-400 | C/C++ |
static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,
size_t msg_len)
{
struct sock *sk = asoc->base.sk;
int err = 0;
long current_timeo = *timeo_p;
DEFINE_WAIT(wait);
pr_debug("%s: asoc:%p, timeo:%ld, msg_len:%zu\n", __func__, asoc,
*timeo_p, msg_len);
/* Increment the associatio... | cwe | CWE-415 | Unknown |
/*
* File: ximatif.cpp
* Purpose: Platform Independent TIFF Image Class Loader and Writer
* 07/Aug/2001 Davide Pizzolato - www.xdp.it
* CxImage version 7.0.2 07/Feb/2011
*/
#include "ximatif.h"
#ifndef min
#define min(a,b) (((a)<(b))?(a):(b))
#endif
#ifndef max
#define max(a,b) (((a)>(b))?(a):(b))
#endif
#if ... | cwe | CWE-787 | C/C++ |
jpc_enc_tile_t *jpc_enc_tile_create(jpc_enc_cp_t *cp, jas_image_t *image, int tileno)
{
jpc_enc_tile_t *tile;
uint_fast32_t htileno;
uint_fast32_t vtileno;
uint_fast16_t lyrno;
uint_fast16_t cmptno;
jpc_enc_tcmpt_t *tcmpt;
if (!(tile = jas_malloc(sizeof(jpc_enc_tile_t)))) {
goto error;
}
/* Initialize a fe... | cwe | CWE-189 | Unknown |
get_next_token(memarea_t *area,
const char **s, const char *eos, token_rule_t *table)
{
/** Reject any object at least this big; it is probably an overflow, an
* attack, a bug, or some other nonsense. */
#define MAX_UNPARSED_OBJECT_SIZE (128*1024)
/** Reject any line at least this big; it is proba... | cwe | CWE-119 | Unknown |
/**
* Based on Kendo UI Core expression code <https://github.com/telerik/kendo-ui-core#license-information>
*/
'use strict'
function Cache(maxSize) {
this._maxSize = maxSize
this.clear()
}
Cache.prototype.clear = function() {
this._size = 0
this._values = Object.create(null)
}
Cache.prototype.get = function(... | cwe | CWE-1321 | JavaScript |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2000-2022
* All rights reserved
*
* This file is part of GPAC / ISO Media File Format sub-project
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU L... | cwe | CWE-122 | C/C++ |
def get_path
Log.add_info(request, params.inspect)
if params[:thetisBoxSelKeeper].nil? or params[:thetisBoxSelKeeper].empty?
@group_path = '/' + t('paren.unknown')
render(:partial => 'ajax_group_path', :layout => false)
return
end
@selected_id = params[:thetisBoxSelKeeper].split(':')... | cwe | CWE-89 | Ruby |
/**
* $Id: ProxyServlet.java,v 1.4 2013/12/13 13:18:11 david Exp $
* Copyright (c) 2011-2012, JGraph Ltd
*/
package com.mxgraph.online;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.... | cwe | CWE-79 | Java |
# coding: utf-8
# Need not unicode_literals
from __future__ import division, absolute_import
import io
import re
import codecs
import json
import yaml
from urllib.request import urlopen
from yaml import Loader, SafeLoader
import csv
from csv import register_dialect, Dialect, QUOTE_MINIMAL
from typing import List, Op... | cwe | CWE-77 | Python |
protocol_handshake_oldstyle (struct connection *conn)
{
struct old_handshake handshake;
int64_t r;
uint64_t exportsize;
uint16_t gflags, eflags;
/* In --tls=require / FORCEDTLS mode, old style handshakes are
* rejected because they cannot support TLS.
*/
if (tls == 2) {
nbdkit_error ("non-TLS cli... | cwe | CWE-406 | Unknown |
/**
* $Id: mxC4.js,v 1.5 2018/26/11 12:32:06 mate Exp $
* Copyright (c) 2006-2018, JGraph Ltd
*/
//**********************************************************************************************************************************************************
// Person
//***************************************************... | cwe | CWE-284 | Java |
LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h) const
{
if (h.isFixed())
return computeContentBoxLogicalHeight(h.value());
if (isRenderView())
return isHorizontalWritingMode() ? toRenderView(this)->frameView()->visibleHeight() : toRenderView(this)->frameView()->visibleWidth()... | cwe | CWE-704 | C/C++ |
static int get_task_ioprio(struct task_struct *p)
{
int ret;
ret = security_task_getioprio(p);
if (ret)
goto out;
ret = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, IOPRIO_NORM);
if (p->io_context)
ret = p->io_context->ioprio;
out:
return ret;
} | cwe | CWE-416 | C/C++ |
long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
{
unsigned char *p;
unsigned long l;
long n;
int i, al;
if (s->s3->tmp.reuse_message) {
s->s3->tmp.reuse_message = 0;
if ((mt >= 0) && (s->s3->tmp.message_type != mt)) {
al = SSL_AD_UNEXPECTED_MES... | cwe | CWE-125 | Unknown |
/*
* daemon/unbound.c - main program for unbound DNS resolver daemon.
*
* Copyright (c) 2007, NLnet Labs. All rights reserved.
*
* This software is open source.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met... | cwe | CWE-59 | C/C++ |
recoveryStopsAfter(XLogRecord *record)
{
uint8 record_info;
TimestampTz recordXtime;
record_info = record->xl_info & ~XLR_INFO_MASK;
/*
* There can be many restore points that share the same name; we stop
* at the first one.
*/
if (recoveryTarget == RECOVERY_TARGET_NAME &&
record->xl_rmid == RM_XLOG_ID ... | cwe | CWE-119 | Unknown |
QPDF::compute_encryption_key_from_password(
std::string const& password, EncryptionData const& data)
{
// Algorithm 3.2 from the PDF 1.7 Reference Manual
// This code does not properly handle Unicode passwords.
// Passwords are supposed to be converted from OS codepage
// characters to PDFDocEncodi... | cwe | CWE-787 | Unknown |
void FdInStream::readBytes(void* data, int length)
{
if (length < MIN_BULK_SIZE) {
InStream::readBytes(data, length);
return;
}
U8* dataPtr = (U8*)data;
int n = end - ptr;
if (n > length) n = length;
memcpy(dataPtr, ptr, n);
dataPtr += n;
length -= n;
ptr += n;
while (length > 0) {
n... | cwe | CWE-787 | C/C++ |
int jp2_encode(jas_image_t *image, jas_stream_t *out, const char *optstr)
{
jp2_box_t *box;
jp2_ftyp_t *ftyp;
jp2_ihdr_t *ihdr;
jas_stream_t *tmpstream;
int allcmptssame;
jp2_bpcc_t *bpcc;
long len;
uint_fast16_t cmptno;
jp2_colr_t *colr;
char buf[4096];
uint_fast32_t overhead;
jp2_cdefchan_t *cdefchanent;
... | cwe | CWE-125 | Unknown |
TfLiteStatus PrepareAny(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
const TfLiteTensor* input = GetInput(context, node, 0);
TF_LITE_ENSURE_TYPES_EQ(context, input->type, kTfLiteBool);
return PrepareSimple(context, node);
} | cwe | CWE-125 | C/C++ |
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */
/*
* http_server.c -- A simple HTTP/QUIC server
*
* It serves up files from the filesystem.
*/
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/queue.h>
#include <sys/types.h>
#i... | cwe | CWE-476 | C/C++ |
def get_wizard(params, request, session)
if not allowed_for_local_cluster(session, Permissions::READ)
return 403, 'Permission denied'
end
wizard = PCSDWizard.getWizard(params["wizard"])
if wizard != nil
return erb wizard.collection_page
else
return "Error finding Wizard - #{params["wizard"]}"
en... | cwe | CWE-384 | Ruby |
function ta(ra,ia,Da){mxEvent.addListener(ia,"click",function(){Ea!=ia&&(Ea.style.backgroundColor="",Ea=ia,Ea.style.backgroundColor=E,Z.scrollTop=0,Z.innerHTML="",J=0,Pa=Da?Ga[ra][Da]:sa[ra],V=null,N(!1))})} | cwe | CWE-94 | JavaScript |
(function()
{
// Adds electrical stencils
Sidebar.prototype.addElectricalPalette = function()
{
var s = mxConstants.STYLE_VERTICAL_LABEL_POSITION + '=bottom;shadow=0;dashed=0;align=center;html=1;' + mxConstants.STYLE_VERTICAL_ALIGN + '=top;' + mxConstants.STYLE_SHAPE;
var mea = s + '=mxgraph.electrical.abstract.... | cwe | CWE-284 | Java |
def handle(self, command, kwargs=None):
"""
Dispatch and handle processing of the given command.
:param command: Name of command to run.
:type command: unicode
:param kwargs: Arguments to pass to the command handler. If empty, `request.POST` is used.
:type kwargs: dict
... | cwe | CWE-79 | Python |
LibRaw_byte_buffer *LibRaw_buffer_datastream::make_byte_buffer(unsigned int sz)
{
LibRaw_byte_buffer *ret = new LibRaw_byte_buffer(0);
if(streampos + sz > streamsize)
sz = streamsize - streampos;
ret->set_buffer(buf+streampos,sz);
return ret;
} | cwe | CWE-703 | Unknown |
ieee802_11_print(netdissect_options *ndo,
const u_char *p, u_int length, u_int orig_caplen, int pad,
u_int fcslen)
{
uint16_t fc;
u_int caplen, hdrlen, meshdrlen;
struct lladdr_info src, dst;
int llc_hdrlen;
caplen = orig_caplen;
/* Remove FCS, if present */
if (length < fcslen... | cwe | CWE-125 | C/C++ |
/* Copyright 2020 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-122 | C/C++ |
static int ieee80211_fragment(struct ieee80211_tx_data *tx,
struct sk_buff *skb, int hdrlen,
int frag_threshold)
{
struct ieee80211_local *local = tx->local;
struct ieee80211_tx_info *info;
struct sk_buff *tmp;
int per_fragm = frag_threshold - hdrlen - FCS_LEN;
int pos = hdrlen + per_fragm;
int ... | cwe | CWE-200 | C/C++ |
int kvm_create_lapic(struct kvm_vcpu *vcpu, int timer_advance_ns)
{
struct kvm_lapic *apic;
ASSERT(vcpu != NULL);
apic = kzalloc(sizeof(*apic), GFP_KERNEL_ACCOUNT);
if (!apic)
goto nomem;
vcpu->arch.apic = apic;
apic->regs = (void *)get_zeroed_page(GFP_KERNEL_ACCOUNT);
if (!apic->regs) {
printk(KERN_ERR ... | cwe | CWE-703 | Unknown |
TPM_SE_Unmarshal(TPM_SE *target, BYTE **buffer, INT32 *size)
{
TPM_RC rc = TPM_RC_SUCCESS;
if (rc == TPM_RC_SUCCESS) {
rc = UINT8_Unmarshal(target, buffer, size);
}
if (rc == TPM_RC_SUCCESS) {
switch (*target) {
case TPM_SE_HMAC:
case TPM_SE_POLICY:
case TPM_SE_TRIAL:
break;
defaul... | cwe | CWE-787 | Unknown |
static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid)
{
struct sk_buff *skb;
unsigned char *b;
struct nlmsghdr *nlh;
struct tcamsg *t;
struct netlink_callback dcb;
struct rtattr *x;
struct rtattr *tb[TCA_ACT_MAX+1];
struct rtattr *kind;
struct tc_action *a = create_a(0);
int err = -EINV... | cwe | CWE-200 | Unknown |
dir_initialize(int argc, VALUE *argv, VALUE dir)
{
struct dir_data *dp;
rb_encoding *fsenc;
VALUE dirname, opt, orig;
static ID keyword_ids[1];
const char *path;
if (!keyword_ids[0]) {
keyword_ids[0] = rb_id_encoding();
}
fsenc = rb_filesystem_encoding();
rb_scan_args(argc, argv... | cwe | CWE-22 | Unknown |
void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &inPen)
{
#ifdef QT_DEBUG_DRAW
qDebug() << "QPaintEngineEx::stroke()" << pen;
#endif
Q_D(QPaintEngineEx);
if (path.isEmpty())
return;
if (!d->strokeHandler) {
d->strokeHandler = new StrokeHandler(path.elementCount()+4);
... | cwe | CWE-787 | C/C++ |
static void compute_angular_endpoints_for_quant_levels(
unsigned int weight_count,
const float* dec_weight_quant_uvalue,
const float* dec_weight_quant_sig,
unsigned int max_quant_level,
float low_value[12],
float high_value[12]
) {
unsigned int max_quant_steps = quantization_steps_for_level[max_quant_level];
a... | cwe | CWE-787 | 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-79 | Java |
/*
* PMU support
*
* Copyright (C) 2012 ARM Limited
* Author: Will Deacon <will.deacon@arm.com>
*
* This code is based heavily on the ARMv7 perf event code.
*
* 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 ... | cwe | CWE-264 | C/C++ |
int phar_verify_signature(php_stream *fp, size_t end_of_phar, php_uint32 sig_type, char *sig, int sig_len, char *fname, char **signature, int *signature_len, char **error) /* {{{ */
{
int read_size, len;
zend_off_t read_len;
unsigned char buf[1024];
php_stream_rewind(fp);
switch (sig_type) {
case PHAR_SIG_OPEN... | cwe | CWE-119 | C/C++ |
static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
struct mm_walk *walk)
{
struct mem_size_stats *mss = walk->private;
struct vm_area_struct *vma = mss->vma;
pte_t *pte;
spinlock_t *ptl;
spin_lock(&walk->mm->page_table_lock);
if (pmd_trans_huge(*pmd)) {
if (pmd_trans_splitting(... | cwe | CWE-264 | C/C++ |
@Override
protected void configure(HttpSecurity http) throws Exception {
// Enable CSRF (for h2 console!). This is a vulnerability!
http.csrf().disable();
http.headers().frameOptions().sameOrigin();
// Person pages only for authenticated users.
http.authorizeRequests()
... | cwe | CWE-352 | Java |
static int exec_child(
Unit *unit,
const ExecCommand *command,
const ExecContext *context,
const ExecParameters *params,
ExecRuntime *runtime,
DynamicCreds *dcreds,
int socket_fd,
int named_io... | cwe | CWE-269 | Unknown |
__xfs_get_blocks(
struct inode *inode,
sector_t iblock,
struct buffer_head *bh_result,
int create,
bool direct,
bool dax_fault)
{
struct xfs_inode *ip = XFS_I(inode);
struct xfs_mount *mp = ip->i_mount;
xfs_fileoff_t offset_fsb, end_fsb;
int error = 0;
int lockmode = 0;
struct xfs_bmbt_irec ima... | cwe | CWE-362 | C/C++ |
decrypt(gcry_mpi_t output, gcry_mpi_t a, gcry_mpi_t b, ELG_secret_key *skey )
{
gcry_mpi_t t1 = mpi_alloc_secure( mpi_get_nlimbs( skey->p ) );
/* output = b/(a^x) mod p */
gcry_mpi_powm( t1, a, skey->x, skey->p );
mpi_invm( t1, t1, skey->p );
mpi_mulm( output, b, t1, skey->p );
#if 0
if( DBG_CIPHER )
{... | cwe | CWE-200 | Unknown |
int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
{
struct ipv6_txoptions opt_space;
struct udp_sock *up = udp_sk(sk);
struct inet_sock *inet = inet_sk(sk);
struct ipv6_pinfo *np = inet6_sk(sk);
DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name);
struct in6_addr *daddr, *final_p, final;... | cwe | CWE-416 | C/C++ |
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-352 | Java |
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import { mainPage } from "../../support/page_objects/mainPage";
let storedURL = "";
export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} api - FORM vie... | cwe | CWE-400 | JavaScript |
TPMI_RH_NV_INDEX_Unmarshal(TPMI_RH_NV_INDEX *target, BYTE **buffer, INT32 *size)
{
TPM_RC rc = TPM_RC_SUCCESS;
if (rc == TPM_RC_SUCCESS) {
rc = TPM_HANDLE_Unmarshal(target, buffer, size);
}
if (rc == TPM_RC_SUCCESS) {
BOOL isNotNv = (*target < NV_INDEX_FIRST) || (*target > NV_INDEX_LAST);
if (isNo... | cwe | CWE-787 | Unknown |
// Copyright 2012-2020 (c) Peter Širka <petersirka@gmail.com>
//
// 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, cop... | cwe | CWE-94 | JavaScript |
status_t OMXNodeInstance::emptyBuffer(
OMX::buffer_id buffer,
OMX_U32 rangeOffset, OMX_U32 rangeLength,
OMX_U32 flags, OMX_TICKS timestamp) {
Mutex::Autolock autoLock(mLock);
OMX_BUFFERHEADERTYPE *header = findBufferHeader(buffer);
header->nFilledLen = rangeLength;
header-... | cwe | CWE-119 | C/C++ |
static int http_proxy_open(URLContext *h, const char *uri, int flags)
{
HTTPContext *s = h->priv_data;
char hostname[1024], hoststr[1024];
char auth[1024], pathbuf[1024], *path;
char lower_url[100];
int port, ret = 0, attempts = 0;
HTTPAuthType cur_auth_type;
char *authstr;
int new_loc;
... | cwe | CWE-787 | Unknown |
var mxClient={VERSION:"20.2.7",IS_IE:null!=navigator.userAgent&&0<=navigator.userAgent.indexOf("MSIE"),IS_IE11:null!=navigator.userAgent&&!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:null!=navigator.userAgent&&!!navigator.userAgent.match(/Edge\//),IS_EM:"spellcheck"in document.createElement("textarea")&&8==docum... | cwe | CWE-79 | Java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.