code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
void Compute(OpKernelContext* ctx) override {
const Tensor& shape_t = ctx->input(0);
const Tensor& alpha_t = ctx->input(1);
OP_REQUIRES(ctx,
TensorShapeUtils::IsVector(shape_t.shape()) &&
(shape_t.dtype() == DataType::DT_INT32 ||
shape_t.dtype() == D... | cwe | CWE-703 | Unknown |
static ssize_t o2nm_node_local_store(struct config_item *item, const char *page,
size_t count)
{
struct o2nm_node *node = to_o2nm_node(item);
struct o2nm_cluster *cluster = to_o2nm_cluster_from_node(node);
unsigned long tmp;
char *p = (char *)page;
ssize_t ret;
tmp = simple_strtoul(p, &p, 0);
if (!p ||... | cwe | CWE-284 | Unknown |
tabstop_set(char_u *var, int **array)
{
int valcount = 1;
int t;
char_u *cp;
if (var[0] == NUL || (var[0] == '0' && var[1] == NUL))
{
*array = NULL;
return TRUE;
}
for (cp = var; *cp != NUL; ++cp)
{
if (cp == var || cp[-1] == ',')
{
char_u *end;
if (strtol((char *)cp, (c... | cwe | CWE-787 | C/C++ |
package logic
import (
"encoding/json"
"github.com/gravitl/netmaker/database"
)
type serverData struct {
PrivateKey string `json:"privatekey,omitempty" bson:"privatekey,omitempty"`
}
// StorePrivKey - stores server client WireGuard privatekey if needed
func StorePrivKey(serverID string, privateKey string) error ... | cwe | CWE-798 | Go |
static int mux_chr_can_read(void *opaque)
{
CharDriverState *chr = opaque;
MuxDriver *d = chr->opaque;
int m = d->focus;
if ((d->prod[m] - d->cons[m]) < MUX_BUFFER_SIZE)
return 1;
if (d->chr_can_read[m])
return d->chr_can_read[m](d->ext_opaque[m]);
return 0;
} | cwe | CWE-416 | Unknown |
function processOptions(isPreview) {
isPreview = isPreview ? isPreview : false;
// Process preview first so it always loads before the browser hits its
// maximum number of connections to a server as can happen with cubic
// panoramas
if (isPreview && 'preview' in config) {
var p = config.p... | cwe | CWE-79 | JavaScript |
BGD_DECLARE(gdImagePtr) gdImageCreateFromTgaCtx(gdIOCtx* ctx)
{
int bitmap_caret = 0;
oTga *tga = NULL;
/* int pixel_block_size = 0;
int image_block_size = 0; */
volatile gdImagePtr image = NULL;
int x = 0;
int y = 0;
tga = (oTga *) gdMalloc(sizeof(oTga));
if (!tga) {
return NULL;
}
tga->bitmap = NULL;
... | cwe | CWE-125 | C/C++ |
function filterTemplates()
{
var searchTerms = tmplSearchInput.value;
if (searchTerms == '')
{
resetTemplates();
return;
}
if (NewDialog.tagsList[templateFile] == null)
{
var tagsList = {};
for (var cat in categories)
{
var templateList = categories[cat];
for (var i = ... | cwe | CWE-94 | JavaScript |
hostkey_method_ssh_rsa_init(LIBSSH2_SESSION * session,
const unsigned char *hostkey_data,
size_t hostkey_data_len,
void **abstract)
{
libssh2_rsa_ctx *rsactx;
const unsigned char *s, *e, *n;
unsigned long len, e_len, n_len;
... | cwe | CWE-787 | Unknown |
juniper_services_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, register const u_char *p)
{
struct juniper_l2info_t l2info;
struct juniper_services_header {
uint8_t svc_id;
uint8_t flags_len;
uint8_t svc_set_id[2];
uint8... | cwe | CWE-125 | C/C++ |
int caca_dither_bitmap(caca_canvas_t *cv, int x, int y, int w, int h,
caca_dither_t const *d, void const *pixels)
{
int *floyd_steinberg, *fs_r, *fs_g, *fs_b;
uint32_t savedattr;
int fs_length;
int x1, y1, x2, y2, pitch, deltax, deltay, dchmax;
if(!d || !pixels)
retu... | cwe | CWE-369 | C/C++ |
void Compute(OpKernelContext* c) override {
PartialTensorShape element_shape;
OP_REQUIRES_OK(c, TensorShapeFromTensor(c->input(0), &element_shape));
int32 num_elements = c->input(1).scalar<int32>()();
TensorList output;
output.element_shape = element_shape;
output.element_dtype = element_dtype_;... | cwe | CWE-369 | Unknown |
HTMLTreeBuilderSimulator::SimulatedToken HTMLTreeBuilderSimulator::Simulate(
const CompactHTMLToken& token,
HTMLTokenizer* tokenizer) {
SimulatedToken simulated_token = kOtherToken;
if (token.GetType() == HTMLToken::kStartTag) {
const String& tag_name = token.Data();
if (ThreadSafeMatch(tag_name, S... | cwe | CWE-79 | C/C++ |
public function onKernelResponse(ResponseEvent $event)
{
if (!$event->isMainRequest()) {
return;
}
$request = $event->getRequest();
if (!$request->hasSession() || !$request->attributes->get('_security_firewall_run', false)) {
return;
}
if ($... | cwe | CWE-287 | PHP |
static int ext4_destroy_inline_data_nolock(handle_t *handle,
struct inode *inode)
{
struct ext4_inode_info *ei = EXT4_I(inode);
struct ext4_xattr_ibody_find is = {
.s = { .not_found = 0, },
};
struct ext4_xattr_info i = {
.name_index = EXT4_XATTR_INDEX_SYSTEM,
.name = EXT4_XATTR_SYSTEM_DATA,
.value ... | cwe | CWE-119 | C/C++ |
fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc)
{
tmsize_t stride = PredictorState(tif)->stride;
uint32 bps = tif->tif_dir.td_bitspersample / 8;
tmsize_t wc = cc / bps;
tmsize_t count;
uint8 *cp = (uint8 *) cp0;
uint8 *tmp = (uint8 *)_TIFFmalloc(cc);
if((cc%(bps*stride))!=0)
{
TIFFErrorExt(tif->tif_cl... | cwe | CWE-119 | C/C++ |
func Skip(self Protocol, fieldType Type, maxDepth int) (err error) {
if maxDepth <= 0 {
return NewProtocolExceptionWithType(DEPTH_LIMIT, errors.New("Depth limit exceeded"))
}
switch fieldType {
case STOP:
return
case BOOL:
_, err = self.ReadBool()
return
case BYTE:
_, err = self.ReadByte()
return
c... | cwe | CWE-755 | Go |
on_handler_appeared(GDBusConnection *connection,
const gchar *name,
const gchar *name_owner,
gpointer user_data)
{
struct tcmur_handler *handler = user_data;
struct dbus_info *info = handler->opaque;
if (info->register_invocation) {
info->connection = connection;
tcmur_register... | cwe | CWE-476 | Unknown |
/* Determine a canonical name for the current locale's character encoding.
Copyright (C) 2000-2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
by the Free Software Foundation; ... | cwe | CWE-552 | C/C++ |
PHP_FUNCTION(bcsub)
{
char *left, *right;
int left_len, right_len;
long scale_param = 0;
bc_num first, second, result;
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
return;
}
if (arg... | cwe | CWE-20 | Unknown |
struct l2tp_packet_t *l2tp_packet_alloc(int ver, int msg_type,
const struct sockaddr_in *addr, int H,
const char *secret, size_t secret_len)
{
struct l2tp_packet_t *pack = mempool_alloc(pack_pool);
if (!pack)
return NULL;
memset(pack, 0, sizeof(*pack));
INIT_LIST_HEAD(&pack->attrs);
pack->hdr.ver = ve... | cwe | CWE-119 | Unknown |
void hid_debug_event(struct hid_device *hdev, char *buf)
{
unsigned i;
struct hid_debug_list *list;
unsigned long flags;
spin_lock_irqsave(&hdev->debug_list_lock, flags);
list_for_each_entry(list, &hdev->debug_list, node) {
for (i = 0; buf[i]; i++)
list->hid_debug_buf[(list->tail + i) % HID_DEBUG_BUFSIZE] =
... | cwe | CWE-835 | Unknown |
/*
* avilib.c
*
* Copyright (C) Thomas ostreich - June 2001
* multiple audio track support Copyright (C) 2002 Thomas ostreich
*
* Original code:
* Copyright (C) 1999 Rainer Johanni <Rainer@Johanni.de>
*
* This file is part of transcode, a linux video stream processing tool
*
* transcode is free softwa... | cwe | CWE-835 | C/C++ |
bool VaapiVideoDecodeAccelerator::VaapiVP9Accelerator::SubmitDecode(
const scoped_refptr<VP9Picture>& pic,
const Vp9SegmentationParams& seg,
const Vp9LoopFilterParams& lf,
const std::vector<scoped_refptr<VP9Picture>>& ref_pictures,
const base::Closure& done_cb) {
DCHECK(done_cb.is_null());
... | cwe | CWE-362 | C/C++ |
static Image *ReadPSImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
#define BoundingBox "BoundingBox:"
#define BeginDocument "BeginDocument:"
#define BeginXMPPacket "<?xpacket begin="
#define EndXMPPacket "<?xpacket end="
#define ICCProfile "BeginICCProfile:"
#define CMYKCustomColor "CMYKCustomColor:... | cwe | CWE-834 | Unknown |
this.inlineTokens(token.text, token.tokens);
break;
}
case 'table':
{
token.tokens = {
header: [],
cells: []
}; // header
l2 = token.header.length;
for (j = 0; j < l2; j++) {
... | cwe | CWE-400 | JavaScript |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-369 | C/C++ |
package config
import (
"encoding/base64"
"encoding/json"
"github.com/docker/docker/api/types"
)
type dockerNetworkInterfaces struct {
V4 struct {
Subnet string `default:"172.18.0.0/16"`
Gateway string `default:"172.18.0.1"`
}
V6 struct {
Subnet string `default:"fdba:17c8:6c94::/64"`
Gateway string `... | cwe | CWE-400 | Go |
static OPJ_BOOL opj_pi_next_lrcp(opj_pi_iterator_t * pi)
{
opj_pi_comp_t *comp = NULL;
opj_pi_resolution_t *res = NULL;
OPJ_UINT32 index = 0;
if (!pi->first) {
comp = &pi->comps[pi->compno];
res = &comp->resolutions[pi->resno];
goto LABEL_SKIP;
} else {
pi->first = 0... | cwe | CWE-125 | Unknown |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2020 University of Dundee & Open Microscopy Environment.
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software F... | cwe | CWE-200 | Python |
static void virtio_blk_handle_read(VirtIOBlockReq *req)
{
BlockDriverAIOCB *acb;
uint64_t sector;
sector = ldq_p(&req->out->sector);
if (sector & req->dev->sector_mask) {
virtio_blk_rw_complete(req, -EIO);
return;
}
acb = bdrv_aio_readv(req->dev->bs, sector, &req->qiov,
... | cwe | CWE-119 | Unknown |
__zzip_fetch_disk_trailer(int fd, zzip_off_t filesize,
struct _disk_trailer *_zzip_restrict trailer,
zzip_plugin_io_t io)
{
#ifdef DEBUG
#define return(val) { e=val; HINT2("%s", zzip_strerror(e)); goto cleanup; }
#else
#define return(val) { e=val; goto cleanup; }
#end... | cwe | CWE-770 | Unknown |
void XSSAuditor::Init(Document* document,
XSSAuditorDelegate* auditor_delegate) {
DCHECK(IsMainThread());
if (state_ != kUninitialized)
return;
state_ = kFilteringTokens;
if (Settings* settings = document->GetSettings())
is_enabled_ = settings->GetXSSAuditorEnabled();
if (!is_e... | cwe | CWE-79 | C/C++ |
/*
* Copyright 2016 LINE Corporation
*
* LINE Corporation 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 r... | cwe | CWE-74 | Java |
function(){k.checked&&(null==g||g.checked)?q.removeAttribute("disabled"):q.setAttribute("disabled","disabled")}));mxUtils.br(d);return{getLink:function(){return k.checked?"blank"===q.value?"_blank":p:null},getEditInput:function(){return k},getEditSelect:function(){return q}}};EditorUi.prototype.addLinkSection=function(... | cwe | CWE-94 | JavaScript |
def nextRandomString(): String =
new java.math.BigInteger(130, _random).toString(36) // 0..9, a..z | cwe | CWE-613 | Scala |
/*jshint -W051:true, evil:true */
/*eslint-disable */
;(function () {
'use strict'
/*eslint-enable */
// //////////////////////////////////////////////////////////////////////////////
// / @brief module "internal"
// /
// / @file
// /
// / DISCLAIMER
// /
// / Copyright 2004-2013 triAGENS GmbH, Col... | cwe | CWE-918 | C/C++ |
MOBI_RET mobi_find_attrvalue(MOBIResult *result, const unsigned char *data_start, const unsigned char *data_end, const MOBIFiletype type, const char *needle) {
if (!result) {
debug_print("Result structure is null%s", "\n");
return MOBI_PARAM_ERR;
}
result->start = result->end = NULL;
*(r... | cwe | CWE-125 | C/C++ |
this.editingHandler);L=this.graph.getLinkForCell(this.state.cell);M=this.graph.getLinksForState(this.state);this.updateLinkHint(L,M);if(null!=L||null!=M&&0<M.length)z=!0;z&&this.redrawHandles()};mxVertexHandler.prototype.updateLinkHint=function(z,L){try{if(null==z&&(null==L||0==L.length)||1<this.graph.getSelectionCount... | cwe | CWE-94 | JavaScript |
void ShowExtensionInstallDialogImpl(
ExtensionInstallPromptShowParams* show_params,
ExtensionInstallPrompt::Delegate* delegate,
scoped_refptr<ExtensionInstallPrompt::Prompt> prompt) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
ExtensionInstallDialogView* dialog =
new ExtensionInstallDialogVi... | cwe | CWE-17 | C/C++ |
_PUBLIC_ bool ldap_encode(struct ldap_message *msg,
const struct ldap_control_handler *control_handlers,
DATA_BLOB *result, TALLOC_CTX *mem_ctx)
{
struct asn1_data *data = asn1_init(mem_ctx);
int i, j;
if (!data) return false;
asn1_push_tag(data, ASN1_SEQUENCE(0));
asn1_write_Integer(data, msg->message... | cwe | CWE-399 | Unknown |
void ZlibInStream::setUnderlying(InStream* is, int bytesIn_)
{
underlying = is;
bytesIn = bytesIn_;
ptr = end = start;
} | cwe | CWE-787 | C/C++ |
/**
* Set given `path`
*
* @param {Object} obj
* @param {String} path
* @param {Mixed} val
* @return {Object}
* @api public
*/
exports.set = function (obj, path, val) {
var segs = path.split('.');
var attr = segs.pop();
var src = obj;
for (var i = 0; i < segs.length; i++) {
var seg = segs[i];
... | cwe | CWE-1321 | JavaScript |
/*
* f_fs.c -- user mode file system API for USB composite function controllers
*
* Copyright (C) 2010 Samsung Electronics
* Author: Michal Nazarewicz <mina86@mina86.com>
*
* Based on inode.c (GadgetFS) which was:
* Copyright (C) 2003-2004 David Brownell
* Copyright (C) 2003 Agilent Technologies
*
* This prog... | cwe | CWE-416 | C/C++ |
package dsig
import (
"bytes"
"crypto/rsa"
"crypto/x509"
"encoding/base64"
"errors"
"fmt"
"regexp"
"github.com/beevik/etree"
"github.com/russellhaering/goxmldsig/etreeutils"
"github.com/russellhaering/goxmldsig/types"
)
var uriRegexp = regexp.MustCompile("^#[a-zA-Z_][\\w.-]*$")
var whiteSpace = regexp.Must... | cwe | CWE-287 | Go |
int cli_hm_scan(const unsigned char *digest, uint32_t size, const char **virname, const struct cli_matcher *root, enum CLI_HASH_TYPE type) {
const struct cli_htu32_element *item;
unsigned int keylen;
struct cli_sz_hash *szh;
size_t l, r;
if(!digest || !size || size == 0xffffffff || !root || !root->... | cwe | CWE-189 | C/C++ |
negotiate_handshake_newstyle_options (struct connection *conn)
{
struct new_option new_option;
size_t nr_options;
uint64_t version;
uint32_t option;
uint32_t optlen;
char data[MAX_OPTION_LENGTH+1];
struct new_handshake_finish handshake_finish;
const char *optname;
for (nr_options = 0; nr_options < MA... | cwe | CWE-406 | Unknown |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020-2021 CERN.
# Copyright (C) 2020 Northwestern University.
#
# Invenio-Drafts-Resources is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""Primary service for working with records and draf... | cwe | CWE-862 | Python |
bool ParamTraits<SkBitmap>::Read(const base::Pickle* m,
base::PickleIterator* iter,
SkBitmap* r) {
const char* fixed_data;
int fixed_data_size = 0;
if (!iter->ReadData(&fixed_data, &fixed_data_size) ||
(fixed_data_size <= 0)) {
return f... | cwe | CWE-125 | C/C++ |
/*
* 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 file to You under the Apache License, Version 2.0
* (the "License"); you may n... | cwe | CWE-269 | Java |
static void read_multiple_complete_cb(struct gatt_db_attribute *attr, int err,
const uint8_t *value, size_t len,
void *user_data)
{
struct read_mult_data *data = user_data;
struct gatt_db_attribute *next_attr;
uint16_t handle = gatt_db_attribute_get_handle(attr);
uint8_t ecode;
uint16_t length;
if (err... | cwe | CWE-287 | Unknown |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2000-2019
* 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-476 | C/C++ |
TPMI_ALG_PUBLIC_Unmarshal(TPMI_ALG_PUBLIC *target, BYTE **buffer, INT32 *size)
{
TPM_RC rc = TPM_RC_SUCCESS;
if (rc == TPM_RC_SUCCESS) {
rc = TPM_ALG_ID_Unmarshal(target, buffer, size);
}
if (rc == TPM_RC_SUCCESS) {
switch (*target) {
#if ALG_KEYEDHASH
case TPM_ALG_KEYEDHASH:
#endif
#if ALG_RSA
... | cwe | CWE-787 | Unknown |
void operator()(OpKernelContext* ctx, const Index num_segments,
const TensorShape& segment_ids_shape,
typename TTypes<Index>::ConstFlat segment_ids,
const Index data_size, const T* data,
typename TTypes<T, 2>::Tensor output) {
if (output.size()... | cwe | CWE-122 | C/C++ |
void AcceptRoutingHandler<Pipeline, R>::onRoutingData(
uint64_t connId,
typename RoutingDataHandler<R>::RoutingData& routingData) {
// Get the routing pipeline corresponding to this connection
auto routingPipelineIter = routingPipelines_.find(connId);
if (routingPipelineIter == routingPipelines_.end()) {
... | cwe | CWE-400 | C/C++ |
polkit_backend_interactive_authority_check_authorization (PolkitBackendAuthority *authority,
PolkitSubject *caller,
PolkitSubject *subject,
... | cwe | CWE-200 | Unknown |
# -*- coding: utf-8 -*-
# rdiffweb, A web interface to rdiff-backup repositories
# Copyright (C) 2012-2021 rdiffweb contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version ... | cwe | CWE-613 | Python |
static int technisat_usb2_get_ir(struct dvb_usb_device *d)
{
struct technisat_usb2_state *state = d->priv;
u8 *buf = state->buf;
u8 *b;
int ret;
struct ir_raw_event ev;
buf[0] = GET_IR_DATA_VENDOR_REQUEST;
buf[1] = 0x08;
buf[2] = 0x8f;
buf[3] = MINIMUM_IR_BIT_TRANSITION_TICK_COUNT;
buf[4] = MAXIMUM_IR_BIT_TI... | cwe | CWE-125 | Unknown |
inline TfLiteIntArray* GetOutputShapeFromTensor(TfLiteContext* context,
TfLiteNode* node) {
const TfLiteTensor* shape = GetInput(context, node, kShapeTensor);
TfLiteIntArray* output_shape = TfLiteIntArrayCreate(shape->dims->data[0]);
for (int i = 0; i < output_shap... | cwe | CWE-787 | Unknown |
static void lo_release(struct gendisk *disk, fmode_t mode)
{
struct loop_device *lo = disk->private_data;
int err;
if (atomic_dec_return(&lo->lo_refcnt))
return;
mutex_lock(&lo->lo_ctl_mutex);
if (lo->lo_flags & LO_FLAGS_AUTOCLEAR) {
/*
* In autoclear mode, stop the loop thread
* and remove configurati... | cwe | CWE-362 | Unknown |
hostkey_method_ssh_rsa_sig_verify(LIBSSH2_SESSION * session,
const unsigned char *sig,
size_t sig_len,
const unsigned char *m,
size_t m_len, void **abstract)
{
libssh2_rsa_ctx *rsa... | cwe | CWE-787 | Unknown |
*/
int re_yyget_column (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if (! YY_CURRENT_BUFFER)
return 0;
return yycolumn; | cwe | CWE-703 | Unknown |
def save_page
Log.add_info(request, params.inspect)
# Next page
pave_val = params[:page].to_i + 1
@page = sprintf('%02d', pave_val)
page_num = Dir.glob(File.join(Research.page_dir, "_q[0-9][0-9].html.erb")).length
unless params[:research].nil?
params[:research].each do |key, value|
... | cwe | CWE-89 | Ruby |
pgm_print(netdissect_options *ndo,
register const u_char *bp, register u_int length,
register const u_char *bp2)
{
register const struct pgm_header *pgm;
register const struct ip *ip;
register char ch;
uint16_t sport, dport;
u_int nla_afnum;
char nla_buf[INET6_ADDRSTRLEN];
register const stru... | cwe | CWE-125 | C/C++ |
public Response workspaceClientEnqueue(@FormParam(WorkSpaceAdapter.CLIENT_NAME) String clientName,
@FormParam(WorkSpaceAdapter.WORK_BUNDLE_OBJ) String workBundleString) {
logger.debug("TPWorker incoming execute! check prio={}", Thread.currentThread().getPriority());
// TODO Doesn't look like... | cwe | CWE-502 | Java |
void TightDecoder::FilterGradient(const rdr::U8* inbuf,
const PixelFormat& pf, PIXEL_T* outbuf,
int stride, const Rect& r)
{
int x, y, c;
static rdr::U8 prevRow[TIGHT_MAX_WIDTH*3];
static rdr::U8 thisRow[TIGHT_MAX_WIDTH*3];
rdr::U8 pix[3];
i... | cwe | CWE-787 | C/C++ |
void pjsua_init_tpselector(pjsua_transport_id tp_id,
pjsip_tpselector *sel)
{
pjsua_transport_data *tpdata;
unsigned flag;
pj_bzero(sel, sizeof(*sel));
if (tp_id == PJSUA_INVALID_ID)
return;
pj_assert(tp_id >= 0 && tp_id < (int)PJ_ARRAY_SIZE(pjsua_var.tpdata));
tpdata = &pjsua_var.tpdat... | cwe | CWE-120 | Unknown |
/* ----------------------------------------------------------------------------
* ATMEL Microcontroller Software Support
* ----------------------------------------------------------------------------
* Copyright (c) 2015, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and... | cwe | CWE-326 | C/C++ |
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "cmark_ctype.h"
#include "config.h"
#include "node.h"
#include "parser.h"
#include "references.h"
#include "cmark-gfm.h"
#include "houdini.h"
#include "utf8.h"
#include "scanners.h"
#include "inlines.h"
#include "syntax_extension.h"
static const char... | cwe | CWE-400 | C/C++ |
/************************************************************
* Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice ap... | cwe | CWE-400 | C/C++ |
static int do_setxattr(struct btrfs_trans_handle *trans,
struct inode *inode, const char *name,
const void *value, size_t size, int flags)
{
struct btrfs_dir_item *di;
struct btrfs_root *root = BTRFS_I(inode)->root;
struct btrfs_path *path;
size_t name_len = strlen(name);
int ret = 0;
if (name_... | cwe | CWE-362 | C/C++ |
PackLinuxElf64::PackLinuxElf64help1(InputFile *f)
{
e_type = get_te16(&ehdri.e_type);
e_phnum = get_te16(&ehdri.e_phnum);
e_shnum = get_te16(&ehdri.e_shnum);
unsigned const e_phentsize = get_te16(&ehdri.e_phentsize);
if (ehdri.e_ident[Elf64_Ehdr::EI_CLASS]!=Elf64_Ehdr::ELFCLASS64
|| sizeof(Elf6... | cwe | CWE-476 | Unknown |
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Windows Clipboard Redirection
*
* Copyright 2012 Jason Champion
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2015 Thincast Technologies GmbH
* Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
*
* L... | cwe | CWE-20 | C/C++ |
'use strict';
const datastore = require('@google-cloud/datastore')();
class Cache {
async clearCache() {
const query = datastore.createQuery('Page');
const data = await datastore.runQuery(query);
const entities = data[0];
const entityKeys = entities.map((entity) => entity[datastore.KEY]);
consol... | cwe | CWE-79 | JavaScript |
requestResetPassword(req) {
const config = req.config;
if (!config) {
this.invalidRequest();
}
if (!config.publicServerURL) {
return this.missingPublicServerURL();
}
const { username, token } = req.query;
if (!username || !token) {
return this.invalidLink(req);
}
... | cwe | CWE-863 | JavaScript |
struct clock_source *dcn10_clock_source_create(
struct dc_context *ctx,
struct dc_bios *bios,
enum clock_source_id id,
const struct dce110_clk_src_regs *regs,
bool dp_clk_src)
{
struct dce110_clk_src *clk_src =
kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
if (!clk_src)
return NULL;
if (dce112_clk_s... | cwe | CWE-401 | Unknown |
static int uvesafb_setcmap(struct fb_cmap *cmap, struct fb_info *info)
{
struct uvesafb_pal_entry *entries;
int shift = 16 - dac_width;
int i, err = 0;
if (info->var.bits_per_pixel == 8) {
if (cmap->start + cmap->len > info->cmap.start +
info->cmap.len || cmap->start < info->cmap.start)
return -EINVAL... | cwe | CWE-190 | C/C++ |
static GF_Err isoffin_setup(GF_Filter *filter, ISOMReader *read)
{
char szURL[2048];
char *tmp, *src;
GF_Err e;
const GF_PropertyValue *prop;
if (!read) return GF_SERVICE_ERROR;
if (read->pid) {
prop = gf_filter_pid_get_property(read->pid, GF_PROP_PID_FILEPATH);
assert(prop);
src = prop->value.string;
} e... | cwe | CWE-787 | Unknown |
GC_INNER void * GC_debug_generic_malloc_inner_ignore_off_page(size_t lb,
int k)
{
void * result = GC_generic_malloc_inner_ignore_off_page(
lb + DEBUG_BYTES, k);
if (result == 0) {
GC_err_pr... | cwe | CWE-119 | Unknown |
sixel_allocator_realloc(
sixel_allocator_t /* in */ *allocator, /* allocator object */
void /* in */ *p, /* existing buffer to be re-allocated */
size_t /* in */ n) /* re-allocation size */
{
/* precondition */
assert(allocator);
assert(allocator... | cwe | CWE-125 | Unknown |
static size_t WritePSDChannels(const PSDInfo *psd_info,
const ImageInfo *image_info,Image *image,Image *next_image,
MagickOffsetType size_offset,const MagickBooleanType separate,
ExceptionInfo *exception)
{
Image
*mask;
MagickOffsetType
rows_offset;
size_t
channels,
count,
length,
... | cwe | CWE-787 | Unknown |
function buildAttributesMap(attrStr, jPath) {
if (!this.options.ignoreAttributes && typeof attrStr === 'string') {
// attrStr = attrStr.replace(/\r?\n/g, ' ');
//attrStr = attrStr || attrStr.trim();
const matches = util.getAllMatches(attrStr, attrsRegx);
const len = matches.length; //don't make it in... | cwe | CWE-1321 | JavaScript |
tgs_build_reply(krb5_context context,
krb5_kdc_configuration *config,
KDC_REQ *req,
KDC_REQ_BODY *b,
hdb_entry_ex *krbtgt,
krb5_enctype krbtgt_etype,
const krb5_keyblock *replykey,
int rk_is_subkey,
krb5_ticket *ticket,
krb5_data *reply,
const char *from,
const char **e_text,
AuthorizationData *... | cwe | CWE-284 | Unknown |
ieee802_15_4_if_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, const u_char *p)
{
u_int caplen = h->caplen;
u_int hdrlen;
uint16_t fc;
uint8_t seq;
uint16_t panid = 0;
if (caplen < 3) {
ND_PRINT((ndo, "[|802.15.4]"));
return caplen;
}
hdrlen = 3;
fc = EXTRACT_LE_16BITS(... | cwe | CWE-125 | C/C++ |
#
# Copyright (c) 2013 Red Hat, Inc.
#
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy ... | cwe | CWE-264 | Python |
dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, int *ok)
{
unsigned char wire[DTLS1_HM_HEADER_LENGTH];
unsigned long len, frag_off, frag_len;
int i,al;
struct hm_header_st msg_hdr;
/* see if we have the required fragment already */
if ((frag_len = dtls1_retrieve_buffe... | cwe | CWE-399 | Unknown |
private function convertTimestamp( $inputDate ) {
$timestamp = $inputDate;
switch ( $inputDate ) {
case 'today':
$timestamp = date( 'YmdHis' );
break;
case 'last hour':
$date = new \DateTime();
$date->sub( new \DateInterval( 'P1H' ) );
$timestamp = $date->format( 'YmdHis' );
break;
... | cwe | CWE-400 | PHP |
def nav_path(request):
"""Return current path as list of items with "name" and "href" members
The href members are view_directory links for directories and view_log
links for files, but are set to None when the link would point to
the current view"""
if not request.repos:
return []
is_dir = request.p... | cwe | CWE-79 | Python |
struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
struct request_sock *req,
struct dst_entry *dst)
{
struct inet_request_sock *ireq;
struct inet_sock *newinet;
struct tcp_sock *newtp;
struct sock *newsk;
#ifdef CONFIG_TCP_MD5SIG
struct tcp_md5sig_key *key;
#endif
if (sk_acceptq_... | cwe | CWE-362 | C/C++ |
/*
*
* Copyright 2019 Asylo authors
*
* 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 agree... | cwe | CWE-125 | C/C++ |
AccessControlStatus ScriptResource::CalculateAccessControlStatus() const {
if (GetCORSStatus() == CORSStatus::kServiceWorkerOpaque)
return kOpaqueResource;
if (IsSameOriginOrCORSSuccessful())
return kSharableCrossOrigin;
return kNotSharableCrossOrigin;
} | cwe | CWE-200 | C/C++ |
AuthenticationFeature::AuthenticationFeature(application_features::ApplicationServer& server)
: ApplicationFeature(server, "Authentication"),
_userManager(nullptr),
_authCache(nullptr),
_authenticationUnixSockets(true),
_authenticationSystemOnly(true),
_localAuthentication(true),
... | cwe | CWE-613 | C/C++ |
public function rename(){
if($this->request->isMethod('POST')){
if(\Storage::move($this->request->input('old_file'), $this->request->input('new_file'))){
if($this->request->ajax()){
return response()->json(['success' => trans('File successfully renamed!')]);
... | cwe | CWE-434 | PHP |
static char* allocFromUTF32(const char32_t* in, size_t len)
{
if (len == 0) {
return getEmptyString();
}
const ssize_t bytes = utf32_to_utf8_length(in, len);
if (bytes < 0) {
return getEmptyString();
}
SharedBuffer* buf = SharedBuffer::alloc(bytes+1);
ALOG_ASSERT(buf, ... | cwe | CWE-119 | C/C++ |
void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
int width, int height,
GfxImageColorMap *colorMap,
Stream *maskStr,
int maskWidth, int maskHeight,
GfxImageColorMap *maskColorMap)
{
ImageStream *maskImgStr;
maskImgStr = new ImageStream(maskStr, maskWidth,
... | cwe | CWE-189 | C/C++ |
"""
LTI Consumer related Signal handlers
"""
import logging
from django.db.models.signals import post_save
from django.dispatch import receiver, Signal
from lti_consumer.models import LtiAgsScore
from lti_consumer.plugin import compat
log = logging.getLogger(__name__)
@receiver(post_save, sender=LtiAgsScore, disp... | cwe | CWE-862 | Python |
"""
Copyright 2014-2015. Jorgen Maas <jorgen.maas@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is d... | cwe | CWE-863 | Python |
int ecc_map(ecc_point* P, mp_int* modulus, mp_digit mp)
{
#ifndef WOLFSSL_SP_MATH
#ifdef WOLFSSL_SMALL_STACK
mp_int* t1 = NULL;
mp_int* t2 = NULL;
#ifdef ALT_ECC_SIZE
mp_int* rx = NULL;
mp_int* ry = NULL;
mp_int* rz = NULL;
#endif
#else
mp_int t1[1], t2[1];
#ifdef ALT_ECC_SIZE
mp_int rx[1], ry[1]... | cwe | CWE-326 | Unknown |
/* Copyright 2006-2007 Niels Provos
* Copyright 2007-2012 Nick Mathewson and Niels Provos
*
* 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
* ... | cwe | CWE-125 | C/C++ |
from pymongo import MongoClient
from pymongo import ReadPreference
import json as _json
import os
import mysql.connector as mysql
import requests
requests.packages.urllib3.disable_warnings()
# NOTE get_user_info_from_auth2 sets up the initial dict.
# The following functions update certain fields in the dict.
# So get... | cwe | CWE-89 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.