code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
static int handle_to_path(int mountdirfd, struct file_handle __user *ufh,
struct path *path)
{
int retval = 0;
struct file_handle f_handle;
struct file_handle *handle = NULL;
/*
* With handle we don't look at the execute bit on the
* the directory. Ideally we would like CAP_DAC_SEARCH.
* But we don't ha... | cwe | CWE-362 | C/C++ |
QPDF_Array::setItem(int n, QPDFObjectHandle const& oh)
{
// Call getItem for bounds checking
(void) getItem(n);
this->items.at(n) = oh;
} | cwe | CWE-787 | Unknown |
static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
{
struct hw_fib * kfib;
struct fib *fibptr;
struct hw_fib * hw_fib = (struct hw_fib *)0;
dma_addr_t hw_fib_pa = (dma_addr_t)0LL;
unsigned size;
int retval;
if (dev->in_reset) {
return -EBUSY;
}
fibptr = aac_fib_alloc(dev);
if(fibptr == NULL)... | cwe | CWE-362 | Unknown |
/* 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-617 | Python |
var FilePropertiesDialog=function(b){var e=document.createElement("table"),f=document.createElement("tbody");e.style.width="100%";e.style.marginTop="8px";var c=b.getCurrentFile();var m=null!=c&&null!=c.getTitle()?c.getTitle():b.defaultFilename;var n=function(){};if(/(\.png)$/i.test(m)){n=1;var v=0;m=b.fileNode;null!=m&... | cwe | CWE-20 | JavaScript |
async getKey(key) {
const bKey = Buffer.from(key);
const abHash = await crypto.subtle.digest('SHA-256', bKey.buffer);
const abKey = Buffer.from(Buffer.from(abHash).toString('hex').slice(0, 32), 'utf8').buffer;
return crypto.subtle.importKey('raw', abKey, 'AES-CBC', true, ['encrypt', 'decrypt']);
} | cwe | CWE-331 | JavaScript |
static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
struct msghdr *msg, size_t len)
{
struct sock_iocb *siocb = kiocb_to_siocb(kiocb);
struct sock *sk = sock->sk;
struct sock *other = NULL;
struct sockaddr_un *sunaddr=msg->msg_name;
int err,size;
struct sk_buff *skb;
int sent=0;
s... | cwe | CWE-399 | Unknown |
n)for(v=0;v<n.length;v++)n[v].node.style.visibility=c?"visible":"hidden"};var f=mxGuide.prototype.destroy;mxGuide.prototype.destroy=function(){f.call(this);var c=this.guidesArrVer,m=this.guidesArrHor;if(null!=c){for(var n=0;n<c.length;n++)c[n].destroy();this.guidesArrVer=null}if(null!=m){for(n=0;n<m.length;n++)m[n].des... | cwe | CWE-20 | JavaScript |
// SPDX-License-Identifier: GPL-2.0+
/*
* linux/fs/jbd2/transaction.c
*
* Written by Stephen C. Tweedie <sct@redhat.com>, 1998
*
* Copyright 1998 Red Hat corp --- All Rights Reserved
*
* Generic filesystem transaction handling code; part of the ext2fs
* journaling system.
*
* This file manages transactions (c... | cwe | CWE-416 | C/C++ |
var profiles = []
// Attempts to send a test email by POSTing to /campaigns/
function sendTestEmail() {
var headers = [];
$.each($("#headersTable").DataTable().rows().data(), function (i, header) {
headers.push({
key: unescapeHtml(header[0]),
value: unescapeHtml(header[1]),
... | cwe | CWE-79 | Go |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011-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... | cwe | CWE-601 | Python |
// Copyright 2022 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... | cwe | CWE-134 | Go |
int vp8_decode_frame(VP8D_COMP *pbi) {
vp8_reader *const bc = &pbi->mbc[8];
VP8_COMMON *const pc = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
const unsigned char *data = pbi->fragments.ptrs[0];
const unsigned int data_sz = pbi->fragments.sizes[0];
const unsigned char *data_end = data + data_sz;
ptrdi... | cwe | CWE-125 | C/C++ |
static long ext4_zero_range(struct file *file, loff_t offset,
loff_t len, int mode)
{
struct inode *inode = file_inode(file);
handle_t *handle = NULL;
unsigned int max_blocks;
loff_t new_size = 0;
int ret = 0;
int flags;
int credits;
int partial_begin, partial_end;
loff_t start, end;
ext4_lblk_t lblk;
... | cwe | CWE-362 | C/C++ |
/*
* asn1.c: ASN.1 decoding functions (DER)
*
* Copyright (C) 2001, 2002 Juha Yrjölä <juha.yrjola@iki.fi>
*
* 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
* version 2.1 o... | cwe | CWE-119 | C/C++ |
mrb_proc_copy(mrb_state *mrb, struct RProc *a, struct RProc *b)
{
if (a->body.irep) {
/* already initialized proc */
return;
}
a->flags = b->flags;
a->body = b->body;
a->upper = b->upper;
if (!MRB_PROC_CFUNC_P(a) && a->body.irep) {
mrb_irep_incref(mrb, (mrb_irep*)a->body.irep);
}
a->e.env = ... | cwe | CWE-122 | C/C++ |
package oci
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net"
"os"
"os/exec"
"path/filepath"
"strconv"
"syscall"
"time"
"github.com/containernetworking/plugins/pkg/ns"
conmonconfig "github.com/containers/conmon/runner/config"
"github.com/containers/storage/pkg/pools"
"github.com/cri-o/cri-o/internal/config... | cwe | CWE-400 | Go |
/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unl... | cwe | CWE-23 | Java |
void SoftAVC::drainOneOutputBuffer(int32_t picId, uint8_t* data) {
List<BufferInfo *> &outQueue = getPortQueue(kOutputPortIndex);
BufferInfo *outInfo = *outQueue.begin();
outQueue.erase(outQueue.begin());
OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader;
OMX_BUFFERHEADERTYPE *header = mPicToHe... | cwe | CWE-20 | C/C++ |
RCMS *r_pkcs7_parse_cms (const ut8 *buffer, ut32 length) {
RASN1Object *object;
RCMS *container;
if (!buffer || !length) {
return NULL;
}
container = R_NEW0 (RCMS);
if (!container) {
return NULL;
}
object = r_asn1_create_object (buffer, length);
if (!object || object->list.length != 2 || !object->list.o... | cwe | CWE-476 | C/C++ |
Label: Core.Language.Translate("Close this dialog"),
Class: 'Primary',
Function: function () {
Core.UI.Dialog.CloseDialog($('#SupportBundleOptionsDialog'));
}
}... | cwe | CWE-20 | JavaScript |
static int read_request(int fd, debugger_request_t* out_request) {
ucred cr;
socklen_t len = sizeof(cr);
int status = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &len);
if (status != 0) {
ALOGE("cannot get credentials");
return -1;
}
ALOGV("reading tid");
fcntl(fd, F_SETFL, O_NONBLOCK);
pollfd po... | cwe | CWE-264 | C/C++ |
/*
* Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy,... | cwe | CWE-287 | Java |
/*
Copyright The Helm 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 agreed to in writing, software
distrib... | cwe | CWE-20 | Go |
def output_versions output, versions
versions.each do |gem_name, matching_tuples|
matching_tuples = matching_tuples.sort_by { |n,_| n.version }.reverse
platforms = Hash.new { |h,version| h[version] = [] }
matching_tuples.each do |n, _|
platforms[n.version] << n.platform if n.platform
... | cwe | CWE-94 | Ruby |
def main(srcfile, dump_module=False):
argv0 = sys.argv[0]
components = argv0.split(os.sep)
argv0 = os.sep.join(components[-2:])
auto_gen_msg = common_msg % argv0
mod = asdl.parse(srcfile)
if dump_module:
print('Parsed Module:')
print(mod)
if not asdl.check(mod):
sys.e... | cwe | CWE-125 | C/C++ |
function deepExtend (a, b) {
// TODO: add support for Arrays to deepExtend
if (Array.isArray(b)) {
throw new TypeError('Arrays are not supported by deepExtend')
}
for (const prop in b) {
if (hasOwnProperty(b, prop)) {
if (b[prop] && b[prop].constructor === Object) {
if (a[prop] === undefi... | cwe | CWE-1321 | JavaScript |
/**
* 2011 Peter 'Pita' Martischka
*
* 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... | cwe | CWE-697 | JavaScript |
static void rtl_p2p_action_ie(struct ieee80211_hw *hw, void *data,
unsigned int len)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct ieee80211_mgmt *mgmt = data;
struct rtl_p2p_ps_info *p2pinfo = &(rtlpriv->psc.p2p_ps_info);
u8 noa_num, index , i , noa_index = 0;
u8 *pos, *end, *ie;
u16 noa_len;
stati... | cwe | CWE-120 | Unknown |
public function jsonError(Exception $exception) {
$message = $exception->getMessage();
$code = $this->getHttpStatusCode($exception);
return new JSONResponse(
[
'message' => $message . ' (' . $code . ')',
'success' => false
],
$code
);
} | cwe | CWE-79 | PHP |
psutil_proc_memory_maps(PyObject *self, PyObject *args) {
int pid;
int fd = -1;
char path[1000];
char perms[10];
const char *name;
struct stat st;
pstatus_t status;
prxmap_t *xmap = NULL, *p;
off_t size;
size_t nread;
int nmap;
uintptr_t pr_addr_sz;
uintptr_t stk_bas... | cwe | CWE-415 | Unknown |
void mysql_read_default_options(struct st_mysql_options *options,
const char *filename,const char *group)
{
int argc;
char *argv_buff[1],**argv;
const char *groups[3];
DBUG_ENTER("mysql_read_default_options");
DBUG_PRINT("enter",("file: %s group: %s",filename,group ? group :"NULL"));
compile_time_asse... | cwe | CWE-319 | Unknown |
App.Actions.DB.update_db_username_hint = function(elm, hint) {
if (hint.trim() == '') {
$(elm).parent().find('.hint').html('');
}
$(elm).parent().find('.hint').text(GLOBAL.DB_USER_PREFIX + hint);
} | cwe | CWE-79 | JavaScript |
/*
* 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 |
static Image *ReadSCRImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
char zxscr[6144];
char zxattr[768];
int octetnr;
int octetline;
int zoneline;
int zonenr;
int octet_val;
int attr_nr;
int pix;
int piy;
int binar[8];
int attrbin[8];
int *pbin;
int ... | cwe | CWE-120 | C/C++ |
/**
* This file is part of alf.io.
*
* alf.io 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 3 of the License, or
* (at your option) any later version.
*
* alf.io is distributed in the ... | cwe | CWE-79 | Java |
#ifndef JSI_LITE_ONLY
#ifndef JSI_AMALGAMATION
#include "jsiInt.h"
#endif
#if JSI__MUSL==1 || defined(__FreeBSD__)
#define NO_QSORT_R 1
#endif
static Jsi_RC jsi_ArrayPushCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
Jsi_Value **ret, Jsi_Func *funcPtr)
{
Jsi_Obj *obj;
if (_this->vt != JSI... | cwe | CWE-190 | C/C++ |
static int add_push_report_sideband_pkt(git_push *push, git_pkt_data *data_pkt, git_buf *data_pkt_buf)
{
git_pkt *pkt;
const char *line, *line_end;
size_t line_len;
int error;
int reading_from_buf = data_pkt_buf->size > 0;
if (reading_from_buf) {
/* We had an existing partial packet, so add the new
* packet... | cwe | CWE-476 | C/C++ |
/*
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator p... | cwe | CWE-732 | Java |
function(J){k=J};this.setAutoScroll=function(J){m=J};this.setOpenFill=function(J){q=J};this.setStopClickEnabled=function(J){A=J};this.setSelectInserted=function(J){z=J};this.setSmoothing=function(J){l=J};this.setPerfectFreehandMode=function(J){M=J};this.setBrushSize=function(J){L.size=J};this.getBrushSize=function(){re... | cwe | CWE-20 | JavaScript |
str_iconveha (const char *src,
const char *from_codeset, const char *to_codeset,
bool transliterate,
enum iconv_ilseq_handler handler)
{
if (*src == '\0' || c_strcasecmp (from_codeset, to_codeset) == 0)
{
char *result = strdup (src);
if (result == NULL)
... | cwe | CWE-476 | C/C++ |
parse_wbxml_tag (proto_tree *tree, tvbuff_t *tvb, guint32 offset,
guint32 str_tbl, guint8 *level,
guint8 *codepage_stag, guint8 *codepage_attr)
{
guint32 tvb_len = tvb_reported_length (tvb);
guint32 off = offset;
guint32 len;
guint str_len;
guint32 ent;
guin... | cwe | CWE-399 | Unknown |
int inotify_rm_wd(struct inotify_handle *ih, u32 wd)
{
struct inotify_watch *watch;
struct inode *inode;
mutex_lock(&ih->mutex);
watch = idr_find(&ih->idr, wd);
if (unlikely(!watch)) {
mutex_unlock(&ih->mutex);
return -EINVAL;
}
get_inotify_watch(watch);
inode = watch->inode;
mutex_unlock(&ih->mutex);
m... | cwe | CWE-362 | Unknown |
public function deleteCommentAction(ProjectComment $comment)
{
$projectId = $comment->getProject()->getId();
try {
$this->repository->deleteComment($comment);
} catch (\Exception $ex) {
$this->flashDeleteException($ex);
}
return $this->redirectToRout... | cwe | CWE-352 | PHP |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import json
from django.http.response import HttpResponse, HttpRes... | cwe | CWE-79 | Python |
void XMLHttpRequest::didFail(const ResourceError& error)
{
if (m_error)
return;
if (error.isCancellation()) {
m_exceptionCode = AbortError;
abortError();
return;
}
if (error.isTimeout()) {
didTimeout();
return;
}
if (error.domain() ... | cwe | CWE-399 | C/C++ |
protected function _afterLoad()
{
if ($this->_addUrlRewrite) {
$this->_addUrlRewrite($this->_urlRewriteCategory);
}
if (count($this) > 0) {
Mage::dispatchEvent('catalog_product_collection_load_after', array('collection' => $this));
}
foreach ($this a... | cwe | CWE-502 | PHP |
void ourWriteOut(CURL *curl, struct OutStruct *outs, const char *writeinfo)
{
FILE *stream = stdout;
const char *ptr = writeinfo;
char *stringp = NULL;
long longinfo;
double doubleinfo;
while(ptr && *ptr) {
if('%' == *ptr) {
if('%' == ptr[1]) {
/* an escaped %-letter */
fputc('%',... | cwe | CWE-200 | C/C++ |
exsltFuncFunctionComp (xsltStylesheetPtr style, xmlNodePtr inst) {
xmlChar *name, *prefix;
xmlNsPtr ns;
xmlHashTablePtr data;
exsltFuncFunctionData *func;
if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
return;
{
xmlChar *qname;
qname = xmlGetProp(inst, (const xm... | cwe | CWE-119 | C/C++ |
rsa_compute_root(const struct rsa_private_key *key,
mpz_t x, const mpz_t m)
{
mpz_t xp; /* modulo p */
mpz_t xq; /* modulo q */
mpz_init(xp); mpz_init(xq);
/* Compute xq = m^d % q = (m%q)^b % q */
mpz_fdiv_r(xq, m, key->q);
mpz_powm(xq, xq, key->b, key->q);
/* Compute xp = m^d % p = (m%p)^a % p ... | cwe | CWE-203 | Unknown |
package providers
import (
"encoding/json"
"errors"
"github.com/TykTechnologies/tyk-identity-broker/constants"
"github.com/TykTechnologies/tyk-identity-broker/tap"
identityHandlers "github.com/TykTechnologies/tyk-identity-broker/tap/identity-handlers"
"github.com/TykTechnologies/tyk-identity-broker/tyk-api"
"g... | cwe | CWE-287 | Go |
window.ocJSON=function(json){var jsonString=parse(json);return JSON.parse(jsonString);};}(window); | cwe | CWE-79 | JavaScript |
MagickExport MemoryInfo *RelinquishVirtualMemory(MemoryInfo *memory_info)
{
assert(memory_info != (MemoryInfo *) NULL);
assert(memory_info->signature == MagickSignature);
if (memory_info->blob != (void *) NULL)
switch (memory_info->type)
{
case AlignedVirtualMemory:
{
memory_info->blob... | cwe | CWE-189 | Unknown |
static void do_busid_cmd(ESPState *s, uint8_t busid)
{
uint32_t cmdlen;
int32_t datalen;
int lun;
SCSIDevice *current_lun;
uint8_t buf[ESP_CMDFIFO_SZ];
trace_esp_do_busid_cmd(busid);
lun = busid & 7;
cmdlen = fifo8_num_used(&s->cmdfifo);
esp_fifo_pop_buf(&s->cmdfifo, buf, cmdlen);
... | cwe | CWE-476 | Unknown |
def write_data_table(self, report, report_data, has_totals=True):
self.data.append([c["title"] for c in report.schema])
for datum in report_data:
datum = report.read_datum(datum)
self.data.append([format_data(data, format_iso_dates=True) for data in datum])
if has_totals... | cwe | CWE-1236 | Python |
struct ldb_message *ldb_msg_copy_shallow(TALLOC_CTX *mem_ctx,
const struct ldb_message *msg)
{
struct ldb_message *msg2;
unsigned int i;
msg2 = talloc(mem_ctx, struct ldb_message);
if (msg2 == NULL) return NULL;
*msg2 = *msg;
msg2->elements = talloc_array(msg2, struct ldb_message_element,
msg2-... | cwe | CWE-200 | Unknown |
dbd_st_fetch(SV *sth, imp_sth_t* imp_sth)
{
dTHX;
int num_fields, ChopBlanks, i, rc;
unsigned long *lengths;
AV *av;
int av_length, av_readonly;
MYSQL_ROW cols;
D_imp_dbh_from_sth;
MYSQL* svsock= imp_dbh->pmysql;
imp_sth_fbh_t *fbh;
D_imp_xxh(sth);
#if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION
MYS... | cwe | CWE-416 | C/C++ |
static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
{
u32 intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
struct vcpu_vmx *vmx = to_vmx(vcpu);
struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
u32 exit_reason = vmx->exit_reason;
if (vmx->nested.nested_run_pending)
return 0;
if (unlikely(vmx->fail)) {
pr_info_rat... | cwe | CWE-20 | C/C++ |
int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param)
{
struct cgroup_fs_context *ctx = cgroup_fc2context(fc);
struct cgroup_subsys *ss;
struct fs_parse_result result;
int opt, i;
opt = fs_parse(fc, cgroup1_fs_parameters, param, &result);
if (opt == -ENOPARAM) {
int ret;
ret = vfs_parse... | cwe | CWE-269 | Unknown |
def register_user(request):
settings = request.registry.settings
if not is_registration_enabled(settings):
raise exc.exception_response(503)
handle_history(request)
_ = request.translate
config = Config(load(get_path_to_form_config('auth.xml', 'ringo')))
form_config = config.get_form('re... | cwe | CWE-327 | Python |
void jpc_qmfb_split_colgrp(jpc_fix_t *a, int numrows, int stride,
int parity)
{
int bufsize = JPC_CEILDIVPOW2(numrows, 1);
jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE * JPC_QMFB_COLGRPSIZE];
jpc_fix_t *buf = splitbuf;
jpc_fix_t *srcptr;
jpc_fix_t *dstptr;
register jpc_fix_t *srcptr2;
register jpc_fix_t *dstptr2;
re... | cwe | CWE-189 | Unknown |
/*
CSV Parse
Please look at the [project documentation](https://csv.js.org/parse/) for additional
information.
*/
const { Transform } = require('stream')
const ResizeableBuffer = require('./ResizeableBuffer')
const cr = 13
const nl = 10
const space = 32
const tab = 9
const bom_utf8 = Buffer.from([239, 187, 191])
c... | cwe | CWE-20 | Java |
import contextlib
import logging
import os
import pathlib
import sys
from typing import (
Any,
Dict,
Generator,
Mapping,
NoReturn,
Optional,
Sequence,
TextIO,
Tuple,
)
import click
import yaml
import vault_cli
from vault_cli import client, environment, exceptions, settings, ssh, ty... | cwe | CWE-74 | Python |
static int mount_entry(const char *fsname, const char *target,
const char *fstype, unsigned long mountflags,
const char *data, int optional)
{
#ifdef HAVE_STATVFS
struct statvfs sb;
#endif
if (mount(fsname, target, fstype, mountflags & ~MS_REMOUNT, data)) {
if (optional) {
INFO("failed to moun... | cwe | CWE-59 | C/C++ |
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/browser/electron_navigation_throttle.h"
#include "content/public/browser/navigation_handle.h"
#include "shell/browser/api/electron_api_web_contents.h"
namespace elect... | cwe | CWE-20 | JavaScript |
srtp_unprotect(srtp_ctx_t *ctx, void *srtp_hdr, int *pkt_octet_len) {
srtp_hdr_t *hdr = (srtp_hdr_t *)srtp_hdr;
uint32_t *enc_start; /* pointer to start of encrypted portion */
uint32_t *auth_start; /* pointer to start of auth. portion */
unsigned int enc_octet_len = 0;/* number of octets in encr... | cwe | CWE-119 | Unknown |
/*
* 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; either version... | cwe | CWE-787 | C/C++ |
# -*- coding: utf-8 -*-
"""
RDFa 1.1 parser, also referred to as a “RDFa Distiller”. It is
deployed, via a CGI front-end, on the U{W3C RDFa 1.1 Distiller page<http://www.w3.org/2012/pyRdfa/>}.
For details on RDFa, the reader should consult the U{RDFa Core 1.1<http://www.w3.org/TR/rdfa-core/>}, U{XHTML+RDFa1.1<http://w... | cwe | CWE-74 | Python |
process_plane(uint8 * in, int width, int height, uint8 * out, int size)
{
int indexw;
int indexh;
int code;
int collen;
int replen;
int color;
int x;
int revcode;
uint8 * last_line;
uint8 * this_line;
uint8 * org_in;
uint8 * org_out;
org_in = in;
org_out = out;
last_line = 0;
indexh = 0;
while (indexh... | cwe | CWE-787 | Unknown |
def delete_access(request, pk):
topic_private = TopicPrivate.objects.for_delete_or_404(pk, request.user)
if request.method == 'POST':
topic_private.delete()
if request.user.pk == topic_private.user_id:
return redirect(reverse("spirit:topic:private:index"))
return redirect(... | cwe | CWE-601 | Python |
/*
* This file is part of Espruino, a JavaScript interpreter for Microcontrollers
*
* Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http... | cwe | CWE-190 | C/C++ |
__rta_reserve(struct sk_buff *skb, int attrtype, int attrlen)
{
struct rtattr *rta;
int size = RTA_LENGTH(attrlen);
rta = (struct rtattr*)skb_put(skb, RTA_ALIGN(size));
rta->rta_type = attrtype;
rta->rta_len = size;
return rta;
} | cwe | CWE-200 | Unknown |
SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
unsigned int *nbytes, struct kvec *iov, int n_vec)
{
struct smb_rqst rqst;
int rc = 0;
struct smb2_write_req *req = NULL;
struct smb2_write_rsp *rsp = NULL;
int resp_buftype;
struct kvec rsp_iov;
int flags = 0;
unsigned int total_len;
*nby... | cwe | CWE-416 | Unknown |
static void gf_dump_vrml_field(GF_SceneDumper *sdump, GF_Node *node, GF_FieldInfo field)
{
u32 i, sf_type;
Bool needs_field_container;
GF_ChildNodeItem *list;
void *slot_ptr;
switch (field.fieldType) {
case GF_SG_VRML_SFNODE:
assert ( *(GF_Node **)field.far_ptr);
if (sdump->XMLDump) {
if (!sdump->X3DDump... | cwe | CWE-476 | C/C++ |
void requestResetPassword() throws Exception
{
when(this.authorizationManager.hasAccess(Right.PROGRAM)).thenReturn(true);
UserReference userReference = mock(UserReference.class);
ResetPasswordRequestResponse requestResponse = mock(ResetPasswordRequestResponse.class);
when(this.resetP... | cwe | CWE-640 | Java |
function msgpack (options) {
var encodingTypes = []
var decodingTypes = new Map()
options = options || {
forceFloat64: false,
compatibilityMode: false,
// if true, skips encoding Dates using the msgpack
// timestamp ext format (-1)
disableTimestampEncoding: false,
preferMap: false
}
... | cwe | CWE-1321 | JavaScript |
/* Parser-tokenizer link implementation */
#include "pgenheaders.h"
#include "tokenizer.h"
#include "node.h"
#include "grammar.h"
#include "parser.h"
#include "parsetok.h"
#include "errcode.h"
#include "graminit.h"
/* Forward */
static node *parsetok(struct tok_state *, grammar *, int, perrdetail *, int *);
static ... | cwe | CWE-125 | Python |
def html_message
key = keys.last.to_s.gsub('_', ' ').gsub(/\b('?[a-z])/) { $1.capitalize }
%(<span class="translation_missing" title="translation missing: #{keys.join('.')}">#{key}</span>) | cwe | CWE-79 | Ruby |
// Copyright 2009 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.
// DragonFly BSD system calls.
// This file is compiled as ordinary Go code,
// but it is also input to mksyscall,
// which parses the //sys lines and generates... | cwe | CWE-287 | Go |
def _get_degree_2(user_id, cnx):
"""Get all users of degree 2 follow that are not currently followed.
Example:
this user (follows) user B (follows) user B
AND user (does NOT follow) user B
means that user B will be in the list
Args:
user_id (int): id of user
cnx: DB c... | cwe | CWE-89 | Python |
def get_acls(session, cib_dom=nil)
unless cib_dom
cib_dom = get_cib_dom(session)
return {} unless cib_dom
end
acls = {
'role' => {},
'group' => {},
'user' => {},
'target' => {}
}
cib_dom.elements.each('/cib/configuration/acls/*') { |e|
type = e.name[4..-1]
if e.name == 'acl_r... | cwe | CWE-384 | Ruby |
package migrations
import (
"context"
"fmt"
"github.com/answerdev/answer/internal/base/data"
"github.com/answerdev/answer/internal/entity"
"xorm.io/xorm"
)
const minDBVersion = 0 // answer 1.0.0
// Migration describes on migration from lower version to high version
type Migration interface {
Description() str... | cwe | CWE-862 | Go |
public int encryptWithAd(byte[] ad, byte[] plaintext, int plaintextOffset,
byte[] ciphertext, int ciphertextOffset, int length) throws ShortBufferException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (!haskey) {
// The key i... | cwe | CWE-787 | Java |
function listTagsHelper(tags, options) {
if (!options && (!tags || !Object.prototype.hasOwnProperty.call(tags, 'length'))) {
options = tags;
tags = this.site.tags;
}
if (!tags || !tags.length) return '';
options = options || {};
const { style = 'list', transform, separator = ', ', suffix = '' } = op... | cwe | CWE-79 | JavaScript |
static int StreamTcpPacketStateSynSent(ThreadVars *tv, Packet *p,
StreamTcpThread *stt, TcpSession *ssn, PacketQueue *pq)
{
if (ssn == NULL)
return -1;
SCLogDebug("ssn %p: pkt received: %s", ssn, PKT_IS_TOCLIENT(p) ?
"toclient":"toserver");
/* RST */
if (... | cwe | CWE-74 | C/C++ |
void luaD_callnoyield (lua_State *L, StkId func, int nResults) {
incXCcalls(L);
if (getCcalls(L) <= CSTACKERR) /* possible stack overflow? */
luaE_freeCI(L);
luaD_call(L, func, nResults);
decXCcalls(L);
} | cwe | CWE-119 | C/C++ |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
auto* params =
reinterpret_cast<TfLiteEmbeddingLookupSparseParams*>(node->builtin_data);
TfLiteTensor* output;
TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, 0, &output));
const TfLiteTensor* ids;
TF_LITE_ENSURE_OK(context, GetInputS... | cwe | CWE-190 | C/C++ |
"""Identity related views."""
from reversion import revisions as reversion
from django.contrib.auth import mixins as auth_mixins
from django.contrib.auth.decorators import (
login_required, permission_required, user_passes_test
)
from django.shortcuts import render
from django.template.loader import render_to_str... | cwe | CWE-352 | Python |
static int16_t decodeSample(ms_adpcm_state &state,
uint8_t code, const int16_t *coefficient)
{
int linearSample = (state.sample1 * coefficient[0] +
state.sample2 * coefficient[1]) >> 8;
linearSample += ((code & 0x08) ? (code - 0x10) : code) * state.delta;
linearSample = clamp(linearSample, MIN_INT16, MAX_INT16)... | cwe | CWE-190 | C/C++ |
const got = require('@/utils/got');
const cheerio = require('cheerio');
const parser = require('@/utils/rss-parser');
module.exports = async (ctx) => {
const { domain = 'news', category } = ctx.params;
const baseUrl = `https://${domain}.gamme.com.tw`;
const feed = await parser.parseURL(`${baseUrl + (catego... | cwe | CWE-918 | JavaScript |
var mxIsElectron = navigator.userAgent != null &&
navigator.userAgent.toLowerCase().indexOf(' electron/') > -1;
var GOOGLE_APPS_MAX_AREA = 25000000;
var GOOGLE_SHEET_MAX_AREA = 1048576; //1024x1024
//TODO Add support for loading math from a local folder
Editor.initMath((remoteMath? 'https://app.diagrams.net/' : '') +... | cwe | CWE-79 | JavaScript |
/* @license
Papa Parse
v5.1.1
https://github.com/mholt/PapaParse
License: MIT
*/
(function(root, factory)
{
/* globals define */
if (typeof define === 'function' && define.amd)
{
// AMD. Register as an anonymous module.
define([], factory);
}
else if (typeof module === 'object' && typeof exports !== 'undefine... | cwe | CWE-1333 | JavaScript |
# -*- coding: utf-8 -*- # pylint: disable=too-many-lines
#
""" Drag and Drop v2 XBlock """
# Imports ###########################################################
from __future__ import absolute_import
from collections import Counter
import copy
import json
import logging
import six.moves.urllib.error # pylint: disa... | cwe | CWE-79 | Python |
/* 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-125 | C/C++ |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
auto* params = reinterpret_cast<TfLiteMulParams*>(node->builtin_data);
OpData* data = reinterpret_cast<OpData*>(node->user_data);
const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1);
const TfLiteTensor* input2 = GetInput(context, nod... | cwe | CWE-125 | C/C++ |
bool operator()(const OpKernelContext* context,
typename TTypes<float, 4>::ConstTensor grads,
typename TTypes<float, 2>::ConstTensor boxes,
typename TTypes<int32, 1>::ConstTensor box_index,
typename TTypes<T, 4>::Tensor grads_image,
... | cwe | CWE-703 | Unknown |
"""Implementation of the WebSocket protocol.
`WebSockets <http://dev.w3.org/html5/websockets/>`_ allow for bidirectional
communication between the browser and server.
.. warning::
The WebSocket protocol was recently finalized as `RFC 6455
<http://tools.ietf.org/html/rfc6455>`_ and is not yet supported in
al... | cwe | CWE-203 | Python |
static void gatherSecurityPolicyViolationEventData(
SecurityPolicyViolationEventInit& init,
ExecutionContext* context,
const String& directiveText,
const ContentSecurityPolicy::DirectiveType& effectiveType,
const KURL& blockedURL,
const String& header,
RedirectStatus redirectStatus,
Cont... | cwe | CWE-200 | C/C++ |
@app.route('/lookup_assets')
def lookup_assets():
start = request.args.get('start')
con = psycopg2.connect(**config.POSTGRES)
cur = con.cursor()
query = "SELECT aname FROM assets WHERE aname LIKE '"+start+"%'"
cur.execute(query)
results = cur.fetchall()
con.close()
return jsonify(resul... | cwe | CWE-89 | Python |
"""Identity related views."""
from reversion import revisions as reversion
from django.contrib.auth import mixins as auth_mixins
from django.contrib.auth.decorators import (
login_required, permission_required, user_passes_test
)
from django.shortcuts import render
from django.template.loader import render_to_str... | cwe | CWE-352 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.