code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
/*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2002-2014 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc.
*
* OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
*
* OpenNMS(... | cwe | CWE-79 | Java |
static int ahash_save_req(struct ahash_request *req, crypto_completion_t cplt)
{
struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
unsigned long alignmask = crypto_ahash_alignmask(tfm);
unsigned int ds = crypto_ahash_digestsize(tfm);
struct ahash_request_priv *priv;
priv = kmalloc(sizeof(*priv) + ahash_align_b... | cwe | CWE-835 | Unknown |
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "device/gamepad/gamepad_monitor.h"
#include <utility>
#include "base/memory/ptr_util.h"
#include "device/gamepad/gamepad_service.h"
#includ... | cwe | CWE-119 | C/C++ |
/* 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-125 | Python |
def _create_3par_iscsi_host(self, hostname, iscsi_iqn, domain, persona_id):
"""Create a 3PAR host.
Create a 3PAR host, if there is already a host on the 3par using
the same iqn but with a different hostname, return the hostname
used by 3PAR.
"""
cmd = 'createhost -iscsi ... | cwe | CWE-78 | Python |
static PyObject *__pyx_f_17clickhouse_driver_14bufferedwriter___pyx_unpickle_BufferedWriter__set_state(struct __pyx_obj_17clickhouse_driver_14bufferedwriter_BufferedWriter *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
cha... | cwe | CWE-120 | C/C++ |
void Compute(OpKernelContext* ctx) override {
const Tensor* hypothesis_indices;
const Tensor* hypothesis_values;
const Tensor* hypothesis_shape;
const Tensor* truth_indices;
const Tensor* truth_values;
const Tensor* truth_shape;
OP_REQUIRES_OK(ctx, ctx->input("hypothesis_indices", &hypothesi... | cwe | CWE-787 | C/C++ |
dfafree (struct dfa *d)
{
int i;
struct dfamust *dm, *ndm;
free(d->charclasses);
free(d->tokens);
if (d->mb_cur_max > 1)
free_mbdata(d);
for (i = 0; i < d->sindex; ++i) {
free(d->states[i].elems.elems);
if (MBS_SUPPORT)
free(d->states[i].mbps.elems);
}
free(d->states);
for (i = 0;... | cwe | CWE-189 | Unknown |
void Compute(OpKernelContext* context) override {
// Here's the basic idea:
// Batch and depth dimension are independent from row and col dimension. And
// because FractionalAvgPool currently only support pooling along row and
// col, we can basically think of this 4D tensor backpropagation as
// op... | cwe | CWE-369 | C/C++ |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2017-2018 New Vector Ltd
# Copyright 2019 The Matrix.org Foundation C.I.C.
#
# 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 Licens... | cwe | CWE-74 | Python |
def json_encode(obj)
JSON.dump(obj)
end | cwe | CWE-502 | Ruby |
void ExternalProtocolHandler::LaunchUrlWithDelegate(
const GURL& url,
int render_process_host_id,
int render_view_routing_id,
ui::PageTransition page_transition,
bool has_user_gesture,
Delegate* delegate) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
std::string escaped_url_string = ... | cwe | CWE-20 | C/C++ |
define([
'../res/widgetTemplate.html',
'./Rule',
'./ConditionManager',
'./TestDataManager',
'./WidgetDnD',
'./eventHelpers',
'objectUtils',
'lodash',
'zepto',
'@braintree/sanitize-url'
], function (
widgetTemplate,
Rule,
ConditionManager,
TestDataManager,
Widg... | cwe | CWE-79 | JavaScript |
static int parse_playlist(HLSContext *c, const char *url,
struct playlist *pls, AVIOContext *in)
{
int ret = 0, is_segment = 0, is_variant = 0;
int64_t duration = 0;
enum KeyType key_type = KEY_NONE;
uint8_t iv[16] = "";
int has_iv = 0;
char key[MAX_URL_SIZE] = "";
... | cwe | CWE-416 | C/C++ |
/*
* Copyright © 2015-2018 Aeneas Rekkas <aeneas+oss@aeneas.io>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required... | cwe | CWE-755 | Go |
// Copyright 2013 Unknown
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writ... | cwe | CWE-22 | Go |
function ParserHandle(_config)
{
// One goal is to minimize the use of regular expressions...
var MAX_FLOAT = Math.pow(2, 53);
var MIN_FLOAT = -MAX_FLOAT;
var FLOAT = /^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i;
var ISO_DATE = /(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d... | cwe | CWE-1333 | JavaScript |
"""
A base Application class for Jupyter applications.
All Jupyter applications should inherit from this.
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import logging
import os
import sys
from copy import deepcopy
from shutil import which
from traitlets imp... | cwe | CWE-269 | Python |
rx_cache_insert(netdissect_options *ndo,
const u_char *bp, const struct ip *ip, int dport)
{
struct rx_cache_entry *rxent;
const struct rx_header *rxh = (const struct rx_header *) bp;
if (ndo->ndo_snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t)))
return;
rxent = &rx_cache[rx... | cwe | CWE-125 | C/C++ |
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 1994 Linus Torvalds
*
* Cyrix stuff, June 1998 by:
* - Rafael R. Reilova (moved everything from head.S),
* <rreilova@ececs.uc.edu>
* - Channing Corn (tests & fixes),
* - Andrew D. Balsa (code cleanup).
*/
#include <linux/init.h>
#include <linux/ut... | cwe | CWE-203 | C/C++ |
def tag_num_to_tag(self, tag_num):
''' Returns tag given tag_num. '''
q = "SELECT tag FROM tags WHERE rowid = '" + str(tag_num) + "'"
self.query(q)
return self.c.fetchone()[0] | cwe | CWE-89 | Python |
_eddsa_hash (const struct ecc_modulo *m,
mp_limb_t *rp, size_t digest_size, const uint8_t *digest)
{
mp_size_t nlimbs = (8*digest_size + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
mpn_set_base256_le (rp, nlimbs, digest, digest_size);
if (nlimbs > 2*m->size)
{
/* Special case for Ed448: reduce rp to 2*m... | cwe | CWE-787 | Unknown |
mobility_opt_print(netdissect_options *ndo,
const u_char *bp, const unsigned len)
{
unsigned i, optlen;
for (i = 0; i < len; i += optlen) {
ND_TCHECK(bp[i]);
if (bp[i] == IP6MOPT_PAD1)
optlen = 1;
else {
if (i + 1 < len) {
ND_TCHECK(bp[i + 1]);
optlen = bp[i + 1] + 2;
}
e... | cwe | CWE-125 | C/C++ |
package graphqlbackend
import (
"context"
"encoding/json"
"fmt"
"math"
"path"
"regexp"
"sort"
"strconv"
"sync"
"time"
"github.com/cockroachdb/errors"
"github.com/inconshreveable/log15"
"github.com/neelance/parallel"
"github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
ot... | cwe | CWE-203 | Go |
/*
Copyright (c) 2013. 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++ |
// SPDX-License-Identifier: GPL-2.0-only
#include "cgroup-internal.h"
#include <linux/ctype.h>
#include <linux/kmod.h>
#include <linux/sort.h>
#include <linux/delay.h>
#include <linux/mm.h>
#include <linux/sched/signal.h>
#include <linux/sched/task.h>
#include <linux/magic.h>
#include <linux/slab.h>
#include <linux/vm... | cwe | CWE-416 | C/C++ |
package Controllers;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
import exceptions.UsernameAlreadyExistsE... | cwe | CWE-89 | Java |
import { createPopper } from "@popperjs/core";
import { withPluginApi } from "discourse/lib/plugin-api";
import { iconHTML } from "discourse-common/lib/icon-library";
let inlineFootnotePopper;
function applyInlineFootnotes(elem) {
const footnoteRefs = elem.querySelectorAll("sup.footnote-ref");
footnoteRefs.forEa... | cwe | CWE-755 | JavaScript |
void Compute(OpKernelContext* c) override {
const Tensor& tag = c->input(0);
OP_REQUIRES(c, TensorShapeUtils::IsScalar(tag.shape()),
errors::InvalidArgument("tag must be scalar"));
const Tensor& tensor = c->input(1);
const Tensor& serialized_summary_metadata_tensor = c->input(2);
Su... | cwe | CWE-20 | Unknown |
function testCommandCategorieExistence ($name = NULL) {
global $pearDB, $form;
$id = NULL;
if (isset($form))
$id = $form->getSubmitValue('cmd_category_id');
$DBRESULT = $pearDB->query("SELECT `category_name`, `cmd_category_id` FROM `command_categories` WHERE `category_name` = '".htmlentities($name, ENT... | cwe | CWE-89 | PHP |
package com.salesmanager.shop.admin.model.orders;
import java.io.Serializable;
public class Refund implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2392736671094915447L;
private Long orderId;
private String amount;
public Long getOrderId() {
return orderId;
}
public void... | cwe | CWE-79 | Java |
EditorUi.prototype.setStatusText = function(value)
{
this.statusContainer.innerHTML = value;
// Wraps simple status messages in a div for styling
if (this.statusContainer.getElementsByTagName('div').length == 0)
{
this.statusContainer.innerHTML = '';
var div = this.createStatusDiv(value);
this.statusContaine... | cwe | CWE-94 | JavaScript |
/*
* . .o8 oooo
* .o8 "888 `888
* .o888oo oooo d8b oooo oooo .oooo888 .ooooo. .oooo.o 888 oooo
* 888 `888""8P `888 `888 d88' `888 d88' `88b d88( "8 888 .8P'
* 888 888 888 888 8... | cwe | CWE-79 | JavaScript |
void update_rate_histogram(struct rate_hist *hist,
const vpx_codec_enc_cfg_t *cfg,
const vpx_codec_cx_pkt_t *pkt) {
int i;
int64_t then = 0;
int64_t avg_bitrate = 0;
int64_t sum_sz = 0;
const int64_t now = pkt->data.frame.pts * 1000 *
(uint64_t)cfg->g_timebase.num /
(uint64_t)cfg->g_timebase.den;
int idx = h... | cwe | CWE-119 | C/C++ |
/* 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-120 | Python |
/*
* Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2006 Christophe Dumez
*
* 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 op... | cwe | CWE-79 | C/C++ |
static int jpc_calcssexp(jpc_fix_t stepsize)
{
return jpc_firstone(stepsize) - JPC_FIX_FRACBITS;
} | cwe | CWE-617 | Unknown |
gstd_accept(int fd, char **display_creds, char **export_name, char **mech)
{
gss_name_t client;
gss_OID mech_oid;
struct gstd_tok *tok;
gss_ctx_id_t ctx = GSS_C_NO_CONTEXT;
gss_buffer_desc in, out;
OM_uint32 maj, min;
int ret;
*display_creds = NULL;
*export_name = NULL;
out.length = 0;
in.length = 0... | cwe | CWE-400 | C/C++ |
def sanitize(html, options = {})
return unless html
return html if html.empty?
Loofah.fragment(html).tap do |fragment|
remove_xpaths(fragment, XPATHS_TO_REMOVE)
end.text(options)
end | cwe | CWE-79 | Ruby |
/* global AQL_EXECUTE */
'use strict';
// //////////////////////////////////////////////////////////////////////////////
// DISCLAIMER
//
// Copyright 2010-2013 triAGENS GmbH, Cologne, Germany
// Copyright 2016 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// yo... | cwe | CWE-918 | C/C++ |
/*
* Copyright (c) 2014 kmiya@culti
* Copyright (c) 2014-2016 Hayaki Saito
*
* 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... | cwe | CWE-190 | C/C++ |
int __dns_lookup(const char *name,
int type,
unsigned char **outpacket,
struct resolv_answer *a)
{
/* Protected by __resolv_lock: */
static int last_ns_num = 0;
static uint16_t last_id = 1;
int i, j, fd, rc;
int packet_len;
int name_len;
#ifdef USE_SELECT
struct timeval tv;
fd_set fds;
#else
struct poll... | cwe | CWE-79 | Unknown |
static int do_replace(struct net *net, const void __user *user,
unsigned int len)
{
int ret;
struct arpt_replace tmp;
struct xt_table_info *newinfo;
void *loc_cpu_entry;
struct arpt_entry *iter;
if (copy_from_user(&tmp, user, sizeof(tmp)) != 0)
return -EFAULT;
/* overflow check */
if (... | cwe | CWE-200 | 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 |
zzip_mem_disk_findmatch(ZZIP_MEM_DISK* dir,
char* filespec, ZZIP_DISK_ENTRY* after,
zzip_fnmatch_fn_t compare, int flags) {
return zzip_disk_findmatch(dir->disk, filespec, after, compare, flags); } | cwe | CWE-119 | Unknown |
# -*- coding: utf-8 -*-
""" Drag and Drop v2 XBlock - Utils """
from __future__ import absolute_import
import copy
import re
from collections import namedtuple
from bleach.sanitizer import Cleaner
def _(text):
""" Dummy `gettext` replacement to make string extraction tools scrape strings marked for translation ... | cwe | CWE-79 | Python |
- (CDVFileTransferDelegate*)delegateForUploadCommand:(CDVInvokedUrlCommand*)command
{
NSString* source = [command.arguments objectAtIndex:0];
NSString* server = [command.arguments objectAtIndex:1];
BOOL trustAllHosts = [[command.arguments objectAtIndex:6 withDefault:[NSNumber numberWithBool:YES]] boolValue]... | cwe | CWE-20 | Objective-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 | Python |
(v.style.display="none");q.appendChild(v);b.editor.cancelFirst?(q.appendChild(k),q.appendChild(g),q.appendChild(m)):(q.appendChild(g),q.appendChild(m),q.appendChild(k));t.appendChild(q);this.container=t},CropImageDialog=function(b,f,l,d){function u(){var B=z.checked,F=L.checked,G=v.geometry,N=e.width,J=e.height,E=(300-... | cwe | CWE-20 | JavaScript |
var upload = function(args, on_success, on_failure) {
// Build query
var codecov_endpoint =
args.options.url ||
process.env.codecov_url ||
process.env.CODECOV_URL ||
'https://codecov.io'
var query = {}
var debug = []
var yamlFile =
args.options.yml ||
process.env.codecov_yml ||
pro... | cwe | CWE-78 | JavaScript |
int Jsi_ObjArraySizer(Jsi_Interp *interp, Jsi_Obj *obj, uint len)
{
int nsiz = len + 1, mod = ALLOC_MOD_SIZE;
assert(obj->isarrlist);
if (mod>1)
nsiz = nsiz + ((mod-1) - (nsiz + mod - 1)%mod);
if (nsiz > MAX_ARRAY_LIST) {
Jsi_LogError("array size too large");
return 0;
}
... | cwe | CWE-190 | Unknown |
#include "TerminalClient.hpp"
#include "TelemetryService.hpp"
namespace et {
vector<PortForwardSourceRequest> parseRangesToRequests(const string& input) {
vector<PortForwardSourceRequest> pfsrs;
auto j = split(input, ',');
for (auto& pair : j) {
vector<string> sourceDestination = split(pair, ':');
try {... | cwe | CWE-362 | C/C++ |
pci_get_vdev_info(int slot)
{
struct businfo *bi;
struct slotinfo *si;
struct pci_vdev *dev = NULL;
bi = pci_businfo[0];
assert(bi != NULL);
si = &bi->slotinfo[slot];
if (si != NULL)
dev = si->si_funcs[0].fi_devi;
else
fprintf(stderr, "slot=%d is empty!\n", slot);
return dev;
} | cwe | CWE-617 | C/C++ |
id3_skip (SF_PRIVATE * psf)
{ unsigned char buf [10] ;
memset (buf, 0, sizeof (buf)) ;
psf_binheader_readf (psf, "pb", 0, buf, 10) ;
if (buf [0] == 'I' && buf [1] == 'D' && buf [2] == '3')
{ int offset = buf [6] & 0x7f ;
offset = (offset << 7) | (buf [7] & 0x7f) ;
offset = (offset << 7) | (buf [8] & 0x7f) ;
... | cwe | CWE-119 | C/C++ |
// Package criteria implements a Criteria API based on Masterminds/squirrel
package criteria
import (
"encoding/json"
"errors"
"strings"
"github.com/navidrome/navidrome/log"
"github.com/Masterminds/squirrel"
)
type Expression = squirrel.Sqlizer
type Criteria struct {
Expression
Sort string
Order string
... | cwe | CWE-89 | Go |
static void NOINLINE retrieve_file_data(FILE *dfp)
{
#if ENABLE_FEATURE_WGET_STATUSBAR || ENABLE_FEATURE_WGET_TIMEOUT
# if ENABLE_FEATURE_WGET_TIMEOUT
unsigned second_cnt = G.timeout_seconds;
# endif
struct pollfd polldata;
polldata.fd = fileno(dfp);
polldata.events = POLLIN | POLLPRI;
#endif
progress_meter(PROGR... | cwe | CWE-120 | Unknown |
static mf_t *open_mf_pattern(void *talloc_ctx, struct demuxer *d, char *filename)
{
struct mp_log *log = d->log;
int error_count = 0;
int count = 0;
mf_t *mf = talloc_zero(talloc_ctx, mf_t);
mf->log = log;
if (filename[0] == '@') {
struct stream *s = stream_create(filename + 1,
... | cwe | CWE-134 | C/C++ |
bool Block::IsInvisible() const
{
return bool(int(m_flags & 0x08) != 0);
} | cwe | CWE-119 | C/C++ |
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2019-2021 The Matrix.org Foundation C.I.C.
#
# 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
... | cwe | CWE-22 | Python |
DataPipeConsumerDispatcher::Deserialize(const void* data,
size_t num_bytes,
const ports::PortName* ports,
size_t num_ports,
PlatformHandle* handles,
... | cwe | CWE-20 | C/C++ |
void uwbd_start(struct uwb_rc *rc)
{
rc->uwbd.task = kthread_run(uwbd, rc, "uwbd");
if (rc->uwbd.task == NULL)
printk(KERN_ERR "UWB: Cannot start management daemon; "
"UWB won't work\n");
else
rc->uwbd.pid = rc->uwbd.task->pid;
} | cwe | CWE-119 | C/C++ |
'use strict';
// //////////////////////////////////////////////////////////////////////////////
// / @brief Foxx service manager
// /
// / @file
// /
// / DISCLAIMER
// /
// / Copyright 2013 triagens GmbH, Cologne, Germany
// /
// / Licensed under the Apache License, Version 2.0 (the "License")
// / you may not use th... | cwe | CWE-918 | C/C++ |
static ssize_t _hostfs_write(oe_fd_t* desc, const void* buf, size_t count)
{
ssize_t ret = -1;
file_t* file = _cast_file(desc);
/* Check parameters. */
if (!file || (count && !buf))
OE_RAISE_ERRNO(OE_EINVAL);
/* Call the host. */
if (oe_syscall_write_ocall(&ret, file->host_fd, buf, cou... | cwe | CWE-552 | Unknown |
int FdOutStream::length()
{
return offset + ptr - sentUpTo;
} | cwe | CWE-787 | C/C++ |
@app.route('/<page_name>/history')
def view_page_history(page_name):
query = db.query("select page_content.timestamp, page_content.id from page, page_content where page.id = page_content.page_id and page.page_name = '%s'" % page_name)
page_histories = query.namedresult()
return render_template(
'pa... | cwe | CWE-89 | Python |
static Image *ReadMATImageV4(const ImageInfo *image_info,Image *image,
ExceptionInfo *exception)
{
typedef struct {
unsigned char Type[4];
unsigned int nRows;
unsigned int nCols;
unsigned int imagf;
unsigned int nameLen;
} MAT4_HDR;
long
ldblk;
EndianType
endian;
Image
*ro... | cwe | CWE-772 | C/C++ |
static void print_bpf_insn(struct bpf_insn *insn)
{
u8 class = BPF_CLASS(insn->code);
if (class == BPF_ALU || class == BPF_ALU64) {
if (BPF_SRC(insn->code) == BPF_X)
verbose("(%02x) %sr%d %s %sr%d\n",
insn->code, class == BPF_ALU ? "(u32) " : "",
insn->dst_reg,
bpf_alu_string[BPF_OP(insn->code) >... | cwe | CWE-200 | C/C++ |
import logging
import urllib
from typing import Any, Dict, Iterable, List, Optional
from urllib.parse import urlencode
from django.conf import settings
from django.contrib.auth import authenticate, get_backends
from django.contrib.sessions.backends.base import SessionBase
from django.core import validators
from django... | cwe | CWE-285 | Python |
snd_seq_oss_synth_make_info(struct seq_oss_devinfo *dp, int dev, struct synth_info *inf)
{
struct seq_oss_synth *rec;
if (dp->synths[dev].is_midi) {
struct midi_info minf;
snd_seq_oss_midi_make_info(dp, dp->synths[dev].midi_mapped, &minf);
inf->synth_type = SYNTH_TYPE_MIDI;
inf->synth_subtype = 0;
inf->nr_... | cwe | CWE-200 | Unknown |
static int ras_putdatastd(jas_stream_t *out, ras_hdr_t *hdr, jas_image_t *image, int numcmpts, int *cmpts)
{
int rowsize;
int pad;
unsigned int z;
int nz;
int c;
int x;
int y;
int v;
jas_matrix_t *data[3];
int i;
assert(numcmpts <= 3);
for (i = 0; i < 3; ++i) {
data[i] = 0;
}
for (i = 0; i < numcmpt... | cwe | CWE-476 | Unknown |
var http = require('http');
var querystring = require('querystring');
var errorTemplate = require('../templates/error.js');
const snip = require('../snip.js');
const genReqLogLine = ({ head, method, path, params, suffix }) =>
!process.appParams.color
? [
head,
method,
path[0] + (path.leng... | cwe | CWE-601 | JavaScript |
var match_1 = this._osc_st.exec(this._buffer);
if (match_1 === null) {
pkt.kind = PacketKind.Incomplete;
return pkt;
}
if (match_1[3]) {
pkt.kind = PacketKind.ESC;
... | cwe | CWE-79 | JavaScript |
ServiceManagerContext::ServiceManagerContext() {
service_manager::mojom::ServiceRequest packaged_services_request;
if (service_manager::ServiceManagerIsRemote()) {
auto invitation =
mojo::edk::IncomingBrokerClientInvitation::AcceptFromCommandLine(
mojo::edk::TransportProtocol::kLegacy);
... | cwe | CWE-119 | C/C++ |
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#include "path.h"
#include "posix.h"
#include "repository.h"
#ifdef GIT_WIN32
#include "win32/posix.h"
... | cwe | CWE-20 | C/C++ |
package com.dotmarketing.cms.webforms.action;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
impor... | cwe | CWE-89 | Java |
/*
* 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-285 | Java |
/*
* Monkey's Audio APE demuxer
* Copyright (c) 2007 Benjamin Zores <ben@geexbox.org>
* based upon libdemac from Dave Chapman.
*
* This file is part of FFmpeg.
*
* FFmpeg 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... | cwe | CWE-399 | Java |
TfLiteStatus InitializeTemporaries(TfLiteContext* context, TfLiteNode* node,
OpContext* op_context) {
// Creates a temp index to iterate through input data.
OpData* op_data = reinterpret_cast<OpData*>(node->user_data);
TfLiteIntArrayFree(node->temporaries);
node->temporaries =... | cwe | CWE-787 | C/C++ |
int mainloop(CLIENT *client) {
struct nbd_request request;
struct nbd_reply reply;
gboolean go_on=TRUE;
#ifdef DODBG
int i = 0;
#endif
negotiate(client);
DEBUG("Entering request loop!\n");
reply.magic = htonl(NBD_REPLY_MAGIC);
reply.error = 0;
while (go_on) {
char buf[BUFSIZE];
size_t len;
#ifdef DODBG
i... | cwe | CWE-119 | C/C++ |
function Lr(e){return e+" { ? }"} | cwe | CWE-331 | JavaScript |
requestForm: function (url, params = {}) {
app.openUrlMethodPost(url, params);
} | cwe | CWE-352 | JavaScript |
static char *uncompress(int16_t field_count, char *start, char *end,
char *ptr, char *uncompressed, int uncomp_len,
char **uncompressed_ptr)
{
char *uptr = *uncompressed_ptr; /* position in result buffer */
debug("count %d ptr %p end %p uptr %p", field_count, ptr, end, uptr);
while (field_count-- > 0 && ptr ... | cwe | CWE-787 | C/C++ |
PatternMatch(char *pat, int patdashes, char *string, int stringdashes)
{
char c,
t;
if (stringdashes < patdashes)
return 0;
for (;;) {
switch (c = *pat++) {
case '*':
if (!(c = *pat++))
return 1;
if (c == XK_minus) {
patdashes--;
for (;;) {
while ((t = *strin... | cwe | CWE-125 | C/C++ |
void process_packet(struct msg_digest **mdp)
{
struct msg_digest *md = *mdp;
struct state *st = NULL;
int maj, min;
enum state_kind from_state = STATE_UNDEFINED; /* state we started in */
struct isakmp_hdr *hdr;
#define SEND_NOTIFICATION(t) { \
if (st) \
send_notification_from_state(st, from_state, t); \
... | cwe | CWE-189 | C/C++ |
from pathlib import Path
from urllib.parse import unquote
import base64
import json, os, requests, time, pytz, pymongo
from shutil import rmtree
from requests.exceptions import ConnectionError
from os.path import join, exists
from django.shortcuts import render
from django.core.serializers import serialize
from django.... | cwe | CWE-74 | Python |
// +build !windows
package errors
import "syscall"
// Abort will terminate & sends SIGTERM to process
func Abort(i ...int) {
pgid, err := syscall.Getpgid(syscall.Getpid())
if err != nil {
Exit(err.Error())
}
// nolint:errcheck
syscall.Kill(-pgid, syscall.SIGTERM)
}
| cwe | CWE-476 | Go |
void IndexedDBDatabase::ForceClose() {
scoped_refptr<IndexedDBDatabase> protect(this);
while (!pending_requests_.empty()) {
std::unique_ptr<ConnectionRequest> request =
std::move(pending_requests_.front());
pending_requests_.pop();
request->AbortForForceClose();
}
auto it = connections_... | cwe | CWE-416 | C/C++ |
ConnectionBase::preparseNewBytes(int bytesRead)
{
DebugLog(<< "In State: " << connectionStates[mConnState]);
start: // If there is an overhang come back here, effectively recursing
switch(mConnState)
{
case NewMessage:
{
if (strncmp(mBuffer + mBufferPos, Symbols::CRLFCRLF, 4) =... | cwe | CWE-120 | C/C++ |
static void blk_exit_queue(struct request_queue *q)
{
/*
* Since the I/O scheduler exit code may access cgroup information,
* perform I/O scheduler exit before disassociating from the block
* cgroup controller.
*/
if (q->elevator) {
ioc_clear_queue(q);
elevator_exit(q, q->elevator);
q->elevator = NULL;
... | cwe | CWE-416 | Unknown |
def get_json(self, uri):
"""Make a GET request to an endpoint returning JSON and parse result
:param uri: The URI to make a GET request to.
:type uri: unicode
:return: A deferred containing JSON parsed into a Python object.
:rtype: twisted.internet.defer.Deferred[dict[any, any]... | cwe | CWE-770 | Python |
int sas_discover_end_dev(struct domain_device *dev)
{
int res;
res = sas_notify_lldd_dev_found(dev);
if (res)
return res;
sas_discover_event(dev->port, DISCE_PROBE);
return 0;
} | cwe | CWE-284 | Unknown |
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build aix darwin freebsd linux netbsd openbsd solaris
package unix
import (
"runtime"
)
// Round the length of a raw sockaddr up to align it properly.
f... | cwe | CWE-287 | Go |
void btif_av_event_deep_copy(uint16_t event, char* p_dest, char* p_src) {
BTIF_TRACE_DEBUG("%s", __func__);
tBTA_AV* av_src = (tBTA_AV*)p_src;
tBTA_AV* av_dest = (tBTA_AV*)p_dest;
maybe_non_aligned_memcpy(av_dest, av_src, sizeof(*av_src));
switch (event) {
case BTA_AV_META_MSG_EVT:
if (av_src->meta_msg.p_da... | cwe | CWE-416 | C/C++ |
#
# Copyright (c) 2010 Red Hat, Inc.
#
# Authors: Jeff Ortel <jortel@redhat.com>
#
# 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... | cwe | CWE-264 | Python |
mpls_print(netdissect_options *ndo, const u_char *bp, u_int length)
{
const u_char *p;
uint32_t label_entry;
uint16_t label_stack_depth = 0;
enum mpls_packet_type pt = PT_UNKNOWN;
p = bp;
ND_PRINT((ndo, "MPLS"));
do {
ND_TCHECK2(*p, sizeof(label_entry));
if (length < sizeof(label_entry)) {
ND_PRINT((ndo,... | cwe | CWE-125 | Unknown |
static void b43_request_firmware(struct work_struct *work)
{
struct b43_wl *wl = container_of(work,
struct b43_wl, firmware_load);
struct b43_wldev *dev = wl->current_dev;
struct b43_request_fw_context *ctx;
unsigned int i;
int err;
const char *errmsg;
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
if (!ctx)
... | cwe | CWE-134 | Unknown |
bool SeekHead::ParseEntry(IMkvReader* pReader, long long start, long long size_,
Entry* pEntry) {
if (size_ <= 0)
return false;
long long pos = start;
const long long stop = start + size_;
long len;
const long long seekIdId = ReadUInt(pReader, pos, len);
if (seekIdId != 0... | cwe | CWE-20 | 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-668 | Java |
int inode_init_always(struct super_block *sb, struct inode *inode)
{
static const struct inode_operations empty_iops;
static const struct file_operations no_open_fops = {.open = no_open};
struct address_space *const mapping = &inode->i_data;
inode->i_sb = sb;
inode->i_blkbits = sb->s_blocksize_bits;
inode->i_fla... | cwe | CWE-416 | Unknown |
static MagickBooleanType DecodeImage(Image *image,unsigned char *luma,
unsigned char *chroma1,unsigned char *chroma2,ExceptionInfo *exception)
{
#define IsSync(sum) ((sum & 0xffffff00UL) == 0xfffffe00UL)
#define PCDGetBits(n) \
{ \
sum=(sum << n) & 0xffffffff; \
bits-=n; \
while (bits <= 24) \
{ \
if (p... | cwe | CWE-399 | C/C++ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.