code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
static Image *ReadXWDImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
#define CheckOverflowException(length,width,height) \
(((height) != 0) && ((length)/((size_t) height) != ((size_t) width)))
char
*comment;
Image
*image;
int
x_status;
MagickBooleanType
authentic_colormap;
... | cwe | CWE-369 | C/C++ |
long long mkvparser::UnserializeUInt(
IMkvReader* pReader,
long long pos,
long long size)
{
assert(pReader);
assert(pos >= 0);
if ((size <= 0) || (size > 8))
return E_FILE_FORMAT_INVALID;
long long result = 0;
for (long long i = 0; i < size; ++i)
{
unsigned char... | cwe | CWE-119 | C/C++ |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | cwe | CWE-74 | Python |
do_find_tlv (const unsigned char *buffer, size_t length,
int tag, size_t *nbytes, int nestlevel)
{
const unsigned char *s = buffer;
size_t n = length;
size_t len;
int this_tag;
int composite;
for (;;)
{
buffer = s;
if (n < 2)
return NULL; /* Buffer definitely too short ... | cwe | CWE-20 | Unknown |
int ovl_permission(struct inode *inode, int mask)
{
struct ovl_entry *oe = inode->i_private;
bool is_upper;
struct dentry *realdentry = ovl_entry_real(oe, &is_upper);
struct inode *realinode;
int err;
if (ovl_is_default_permissions(inode)) {
struct kstat stat;
struct path realpath = { .dentry = realdentry };... | cwe | CWE-863 | Unknown |
# -*- coding: utf-8 -*-
from pysqlite2 import dbapi2 as sqlite3
import os.path
class mod_fun(object):
def __init__(self,parent,config):
self.config = config
self.parent = parent
parent.register_callback(u'!snack', self.snack, 'Several small fuckups')
for key in config['items'].keys(... | cwe | CWE-89 | Python |
void NavigationRequest::OnStartChecksComplete(
NavigationThrottle::ThrottleCheckResult result) {
DCHECK(result.action() != NavigationThrottle::DEFER);
DCHECK(result.action() != NavigationThrottle::BLOCK_RESPONSE);
if (on_start_checks_complete_closure_)
on_start_checks_complete_closure_.Run();
if (resul... | cwe | CWE-20 | C/C++ |
void ati_2d_blt(ATIVGAState *s)
{
/* FIXME it is probably more complex than this and may need to be */
/* rewritten but for now as a start just to get some output: */
DisplaySurface *ds = qemu_console_surface(s->vga.con);
DPRINTF("%p %u ds: %p %d %d rop: %x\n", s->vga.vram_ptr,
s->vga.vbe_st... | cwe | CWE-190 | Unknown |
MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info,
Image *images,const char *filename,ExceptionInfo *exception)
{
#define WriteImageTag "Write/Image"
ExceptionInfo
*sans_exception;
ImageInfo
*write_info;
MagickBooleanType
proceed;
MagickOffsetType
progress;
MagickP... | cwe | CWE-476 | C/C++ |
document.createElement("link");N.setAttribute("rel","preload");N.setAttribute("href",T);N.setAttribute("as","font");N.setAttribute("crossorigin","");E.parentNode.insertBefore(N,E)}}}};Editor.trimCssUrl=function(u){return u.replace(RegExp("^[\\s\"']+","g"),"").replace(RegExp("[\\s\"']+$","g"),"")};Editor.GOOGLE_FONTS="h... | cwe | CWE-20 | JavaScript |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2000-2021
* All rights reserved
*
* This file is part of GPAC / text import filter
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General P... | cwe | CWE-415 | C/C++ |
TPMI_ALG_SYM_MODE_Unmarshal(TPMI_ALG_SYM_MODE *target, BYTE **buffer, INT32 *size, BOOL allowNull)
{
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_CTR
case TPM_ALG_CTR:
#endif
#if... | cwe | CWE-787 | Unknown |
/**
* Created by ctalmacel on 12/21/15.
*/
var Q = require('q');
var modelUtil = require("../../lib/ModelDescription.js");
exports.createTable= function(persistenceStrategy,tableName,model){
var query = 'CREATE TABLE IF NOT EXISTS '+tableName+'(';
for(field in model){
query+=field+' ';
var ... | cwe | CWE-89 | JavaScript |
async exec () {
if (this.npm.config.get('global')) {
const err = new Error('`npm ci` does not work for global packages')
err.code = 'ECIGLOBAL'
throw err
}
const where = this.npm.prefix
const opts = {
...this.npm.flatOptions,
path: where,
log,
save: false, // n... | cwe | CWE-345 | JavaScript |
static void Sp_replace_regexp(js_State *J)
{
js_Regexp *re;
const char *source, *s, *r;
js_Buffer *sb = NULL;
int n, x;
Resub m;
source = checkstring(J, 0);
re = js_toregexp(J, 1);
if (js_regexec(re->prog, source, &m, 0)) {
js_copy(J, 0);
return;
}
re->last = 0;
loop:
s = m.sub[0].sp;
n = m.sub[0].e... | cwe | CWE-400 | Unknown |
package com.bezman.servlet;
import org.json.simple.JSONArray;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotatio... | cwe | CWE-89 | Java |
function ame_ajax_set_postdate( post_id, pickedDate, posttype ) {
var ame_sack = new sack( ajaxurl );
ame_sack.execute = 1;
ame_sack.method = 'POST';
ame_sack.setVar( "action", "ame_set_date" );
ame_sack.setVar( "category_id", post_id );
ame_sack.setVar( "pickedDate", pickedDate );
ame_sack.setVar( "posttype", p... | cwe | CWE-352 | JavaScript |
makeDroppable = function() {
setTimeout(function() {
cwd.find('.directory:not(.'+clDroppable+',.elfinder-na,.elfinder-ro)').droppable(fm.droppable);
}, 20);
}, | cwe | CWE-89 | JavaScript |
/* 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-617 | Python |
// Copyright (c) 2012 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 "components/omnibox/browser/history_url_provider.h"
#include <algorithm>
#include <memory>
#include <utility>
#include "base/bind.h"
#inclu... | cwe | CWE-416 | C/C++ |
static int send_full_color_rect(VncState *vs, int x, int y, int w, int h)
{
int stream = 0;
ssize_t bytes;
#ifdef CONFIG_VNC_PNG
if (tight_can_send_png_rect(vs, w, h)) {
return send_png_rect(vs, x, y, w, h, NULL);
}
#endif
tight_pack24(vs, vs->tight.tight.buffer, w * h, &vs->tight.tigh... | cwe | CWE-120 | C/C++ |
# Generated by Django 3.0.7 on 2021-04-04 20:16
import InvenTree.fields
import InvenTree.models
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import markdownx.models
class Migration(migrations.Migration):
dependencies = [... | cwe | CWE-400 | Python |
static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
{
KerndeintContext *kerndeint = inlink->dst->priv;
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *outpic;
const uint8_t *prvp; ///< Previous field's pixel line number n
const uint8_t *prvpp; ///< Previous field's pixel line ... | cwe | CWE-119 | Unknown |
/*
* 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 |
static inline int init_new_context(struct task_struct *tsk,
struct mm_struct *mm)
{
#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
if (cpu_feature_enabled(X86_FEATURE_OSPKE)) {
/* pkey 0 is the default and always allocated */
mm->context.pkey_allocation_map = 0x1;
/* -1 means unallocated or invalid */
... | cwe | CWE-416 | C/C++ |
/*
* bplist.c
* Binary plist implementation
*
* Copyright (c) 2011-2017 Nikias Bassen, All Rights Reserved.
* Copyright (c) 2008-2010 Jonathan Beck, All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as p... | cwe | CWE-119 | C/C++ |
static uint32_t readU16(const uint8_t* data, size_t offset) {
return data[offset] << 8 | data[offset + 1];
} | cwe | CWE-19 | C/C++ |
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */
/*
* lsquic_mm.c -- Memory manager.
*/
#include <assert.h>
#include <errno.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <sys/queue.h>
#include "fiu-local.h"
#include "lsquic.h"
#include "lsquic_int_types.h"
#includ... | cwe | CWE-476 | C/C++ |
lyd_new_yangdata(const struct lys_module *module, const char *name_template, const char *name)
{
const struct lys_node *schema = NULL, *snode;
if (!module || !name_template || !name) {
LOGARG;
return NULL;
}
schema = lyp_get_yang_data_template(module, name_template, strlen(name_templat... | cwe | CWE-119 | Unknown |
sds _sdsMakeRoomFor(sds s, size_t addlen, int greedy) {
void *sh, *newsh;
size_t avail = sdsavail(s);
size_t len, newlen;
char type, oldtype = s[-1] & SDS_TYPE_MASK;
int hdrlen;
size_t usable;
/* Return ASAP if there is enough space left. */
if (avail >= addlen) return s;
len = sds... | cwe | CWE-190 | C/C++ |
static struct kmem_cache *ccid_kmem_cache_create(int obj_size, char *slab_name_fmt, const char *fmt,...)
{
struct kmem_cache *slab;
va_list args;
va_start(args, fmt);
vsnprintf(slab_name_fmt, sizeof(slab_name_fmt), fmt, args);
va_end(args);
slab = kmem_cache_create(slab_name_fmt, sizeof(struct ccid) + obj_size,... | cwe | CWE-476 | Unknown |
processTargetResponse(struct module_qstate* qstate, int id,
struct module_qstate* forq)
{
struct iter_qstate* iq = (struct iter_qstate*)qstate->minfo[id];
struct iter_qstate* foriq = (struct iter_qstate*)forq->minfo[id];
struct ub_packed_rrset_key* rrset;
struct delegpt_ns* dpns;
log_assert(qstate->return_rcode =... | cwe | CWE-400 | Unknown |
struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp keycmp)
{
struct hfs_btree *tree;
struct hfs_btree_header_rec *head;
struct address_space *mapping;
struct page *page;
unsigned int size;
tree = kzalloc(sizeof(*tree), GFP_KERNEL);
if (!tree)
return NULL;
mutex_init(&tree->tree_lo... | cwe | CWE-264 | C/C++ |
public func streamFile(
at path: String,
chunkSize: Int = NonBlockingFileIO.defaultChunkSize,
mediaType: HTTPMediaType? = nil,
onCompleted: @escaping (Result<Void, Error>) -> () = { _ in }
) -> Response {
// Get file attributes for this file.
guard
let att... | cwe | CWE-190 | Swift |
static int expandRegular(rpmfi fi, const char *dest, rpmpsm psm, int nodigest, int nocontent)
{
FD_t wfd = NULL;
int rc = 0;
/* Create the file with 0200 permissions (write by owner). */
{
mode_t old_umask = umask(0577);
wfd = Fopen(dest, "w.ufdio");
umask(old_umask);
}
if (Ferror(... | cwe | CWE-59 | C/C++ |
static int test_alt_chains_cert_forgery(void)
{
int ret = 0;
int i;
X509 *x = NULL;
STACK_OF(X509) *untrusted = NULL;
BIO *bio = NULL;
X509_STORE_CTX *sctx = NULL;
X509_STORE *store = NULL;
X509_LOOKUP *lookup = NULL;
store = X509_STORE_new();
if (store == NULL)
goto err... | cwe | CWE-254 | Unknown |
void CmdLine::addGlobalOptions( boost::program_options::options_description& general ,
boost::program_options::options_description& hidden ,
boost::program_options::options_description& ssl_options ) {
/* support for -vv -vvvv etc. */
... | cwe | CWE-20 | Unknown |
/*
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
di... | cwe | CWE-200 | Go |
mrb_f_send(mrb_state *mrb, mrb_value self)
{
mrb_sym name;
mrb_value block, *regs;
mrb_method_t m;
struct RClass *c;
mrb_callinfo *ci = mrb->c->ci;
int n = ci->n;
if (ci->cci > CINFO_NONE) {
funcall:;
const mrb_value *argv;
mrb_int argc;
mrb_get_args(mrb, "n*&", &name, &argv, &argc, &block)... | cwe | CWE-122 | Unknown |
GF_Err stbl_AppendTime(GF_SampleTableBox *stbl, u32 duration, u32 nb_pack)
{
GF_TimeToSampleBox *stts = stbl->TimeToSample;
if (!nb_pack) nb_pack = 1;
if (stts->nb_entries) {
if (stts->entries[stts->nb_entries-1].sampleDelta == duration) {
stts->entries[stts->nb_entries-1].sampleCount += nb_pack;
return GF_... | cwe | CWE-120 | Unknown |
ztype(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
ref tnref;
int code = array_get(imemory, op, (long)r_btype(op - 1), &tnref);
if (code < 0)
return code;
if (!r_has_type(&tnref, t_name)) {
/* Must be either a stack underflow or a t_[a]struct. */
check_op(2);
{ ... | cwe | CWE-704 | C/C++ |
$removed[] = $fi->getFilename();
}
if ($removed = implode(', ', $removed)) {
$result .= $removed . ' ' . dgettext('tuleap-tracker', 'removed');
}
$added = $this->fetchAddedFiles(array_diff($this->files, $changeset_value->getFiles()), $format, $is_for_mail... | cwe | CWE-79 | PHP |
"pagecount"==F?null!=c.pages?c.pages.length:1:M.apply(this,arguments)};var n=e.labelLinkClicked;e.labelLinkClicked=function(F,G,N){var J=G.getAttribute("href");if(null==J||!e.isCustomLink(J)||!mxEvent.isTouchEvent(N)&&mxEvent.isPopupTrigger(N))n.apply(this,arguments);else{if(!e.isEnabled()||null!=F&&e.isCellLocked(F.ce... | cwe | CWE-20 | JavaScript |
static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s,
AVFrame *p, AVPacket *avpkt)
{
AVDictionary *metadata = NULL;
uint32_t tag, length;
int decode_next_dat = 0;
int ret;
for (;;) {
length = bytestream2_get_bytes_left(&s->gb);
if (l... | cwe | CWE-787 | C/C++ |
const bootbox = require('bootbox');
require('../services/Requisitions');
require('../services/Synchronize');
/**
* @author Alejandro Galue <agalue@opennms.org>
* @copyright 2014 The OpenNMS Group, Inc.
*/
(function() {
'use strict';
const quickAddNodeView = require('../../views/quick-add-node.html');
const c... | cwe | CWE-79 | Java |
function setup(helper) {
helper.allowList([
"div.highlight",
"span.highlight",
"div.sepquote",
"span.smallfont",
"blockquote.indent",
"ol[type=*]",
]);
helper.allowList({
custom(tag, name, value) {
if (tag === "span" && name === "style") {
return /^(font-size:(xx-small|x... | cwe | CWE-79 | JavaScript |
IHEVCD_ERROR_T ihevcd_cabac_init(cab_ctxt_t *ps_cabac,
bitstrm_t *ps_bitstrm,
WORD32 qp,
WORD32 cabac_init_idc,
const UWORD8 *pu1_init_ctxt)
{
/* Sanity checks */
ASSERT(ps_cabac != NULL);
ASSERT(ps_bitstrm != NULL);
ASSERT((qp >= 0) && (q... | cwe | CWE-119 | C/C++ |
static void fwnet_receive_broadcast(struct fw_iso_context *context,
u32 cycle, size_t header_length, void *header, void *data)
{
struct fwnet_device *dev;
struct fw_iso_packet packet;
__be16 *hdr_ptr;
__be32 *buf_ptr;
int retval;
u32 length;
u16 source_node_id;
u32 specifier_id;
u32 ver;
unsigned long offse... | cwe | CWE-787 | Unknown |
public void sendResetPasswordEmailRequest(ResetPasswordRequestResponse requestResponse)
throws ResetPasswordException
{
AuthenticationResourceReference resourceReference =
new AuthenticationResourceReference(AuthenticationAction.RESET_PASSWORD);
UserReference userReference = req... | cwe | CWE-200 | Java |
/*
* Schism Tracker - a cross-platform Impulse Tracker clone
* copyright (c) 2003-2005 Storlek <storlek@rigelseven.com>
* copyright (c) 2005-2008 Mrs. Brisby <mrs.brisby@nimh.org>
* copyright (c) 2009 Storlek & Mrs. Brisby
* copyright (c) 2010-2012 Storlek
* URL: http://schismtracker.org/
*
* This program is fr... | cwe | CWE-787 | C/C++ |
/**
* Copyright (c) 2006-2020, JGraph Ltd
* Copyright (c) 2006-2020, draw.io AG
*/
(function()
{
// Adds scrollbars for menus that exceed the page height
var mxPopupMenuShowMenu = mxPopupMenu.prototype.showMenu;
mxPopupMenu.prototype.showMenu = function()
{
this.div.style.overflowY = 'auto';
this.div.style.o... | cwe | CWE-79 | JavaScript |
enum ImapAuthRes imap_auth_cram_md5(struct ImapData *idata, const char *method)
{
char ibuf[LONG_STRING * 2], obuf[LONG_STRING];
unsigned char hmac_response[MD5_DIGEST_LEN];
int len;
int rc;
if (!mutt_bit_isset(idata->capabilities, ACRAM_MD5))
return IMAP_AUTH_UNAVAIL;
mutt_message(_("Authenticating (... | cwe | CWE-120 | Unknown |
# -*- coding: utf-8 -*-
"""
pygments.lexers.ml
~~~~~~~~~~~~~~~~~~
Lexers for ML family languages.
:copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, bygroups, default, words
from... | cwe | CWE-835 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import time
import hashlib
from datetime import datetime
from .base import WeixinError
try:
from flask import request, Response
except ImportError:
request, Response = None, None
try:
from django.http import HttpResponse, HttpResponseFor... | cwe | CWE-611 | Python |
def prepare_context(self, request, context, *args, **kwargs):
""" Hook for adding additional data to the context dict """
pass | cwe | CWE-200 | JavaScript |
static int nr_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t size, int flags)
{
struct sock *sk = sock->sk;
struct sockaddr_ax25 *sax = (struct sockaddr_ax25 *)msg->msg_name;
size_t copied;
struct sk_buff *skb;
int er;
/*
* This works for seqpacket too. The receiver has ord... | cwe | CWE-20 | C/C++ |
def stream_exists_backend(request, user_profile, stream_id, autosubscribe):
# type: (HttpRequest, UserProfile, int, bool) -> HttpResponse
try:
stream = get_and_validate_stream_by_id(stream_id, user_profile.realm)
except JsonableError:
stream = None
result = {"exists": bool(stream)}
i... | cwe | CWE-200 | Python |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import json, inspect
import frappe
from frappe import _
from frappe.utils import cint
from six import text_type, string_types
@frappe.whitelist()
def runserverobj(method, docs=No... | cwe | CWE-79 | Python |
static void virtio_gpu_set_scanout(VirtIOGPU *g,
struct virtio_gpu_ctrl_command *cmd)
{
struct virtio_gpu_simple_resource *res;
struct virtio_gpu_scanout *scanout;
pixman_format_code_t format;
uint32_t offset;
int bpp;
struct virtio_gpu_set_scanout ss;
VIR... | cwe | CWE-401 | Unknown |
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/ory/fosite (interfaces: Storage)
// Package internal is a generated GoMock package.
package internal
import (
context "context"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
fosite "github.com/ory/fosite"
)
// MockStorage is a mock of ... | cwe | CWE-287 | Go |
static void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags)
{
const struct sched_class *class;
if (p->sched_class == rq->curr->sched_class) {
rq->curr->sched_class->check_preempt_curr(rq, p, flags);
} else {
for_each_class(class) {
if (class == rq->curr->sched_class)
break;
if (cla... | cwe | CWE-835 | Unknown |
ptp_unpack_OPL (PTPParams *params, unsigned char* data, MTPProperties **pprops, unsigned int len)
{
uint32_t prop_count = dtoh32a(data);
MTPProperties *props = NULL;
unsigned int offset = 0, i;
*pprops = NULL;
if (prop_count == 0)
return 0;
if (prop_count >= INT_MAX/sizeof(MTPProperties)) {
ptp_debug (param... | cwe | CWE-190 | C/C++ |
atmarp_print(netdissect_options *ndo,
const u_char *bp, u_int length, u_int caplen)
{
const struct atmarp_pkthdr *ap;
u_short pro, hrd, op;
ap = (const struct atmarp_pkthdr *)bp;
ND_TCHECK(*ap);
hrd = ATMHRD(ap);
pro = ATMPRO(ap);
op = ATMOP(ap);
if (!ND_TTEST2(*aar_tpa(ap), ATMTPROTO_LEN(ap))) {
ND_... | cwe | CWE-125 | Unknown |
import classDiagram from './diagrams/class/styles';
import er from './diagrams/er/styles';
import flowchart from './diagrams/flowchart/styles';
import gantt from './diagrams/gantt/styles';
import gitGraph from './diagrams/git/styles';
import info from './diagrams/info/styles';
import pie from './diagrams/pie/styles';
i... | cwe | CWE-74 | JavaScript |
function updateSelectedTags(tags, selected, selectedColor, filter)
{
tagCloud.innerHTML = '';
var title = document.createElement('div');
title.style.marginBottom = '8px';
mxUtils.write(title, (filter != null) ? 'Select hidden tags:' : 'Or add/remove existing tags for cell(s):');
tagCloud.appendChil... | cwe | CWE-94 | JavaScript |
parse_group_prop_ntr_selection_method(struct ofpbuf *payload,
enum ofp11_group_type group_type,
enum ofp15_group_mod_command group_cmd,
struct ofputil_group_props *gp)
{
struct ntr_group_prop_selection_... | cwe | CWE-617 | C/C++ |
void PaymentRequest::Complete(mojom::PaymentComplete result) {
if (!client_.is_bound())
return;
if (result == mojom::PaymentComplete::FAIL) {
delegate_->ShowErrorMessage();
} else {
DCHECK(!has_recorded_completion_);
journey_logger_.SetCompleted();
has_recorded_completion_ = true;
dele... | cwe | CWE-189 | C/C++ |
/* global host */
/* eslint-disable block-spacing, no-multi-spaces, brace-style, no-array-constructor, new-cap, no-use-before-define */
'use strict';
// eslint-disable-next-line no-invalid-this, no-shadow
const global = this;
const local = host.Object.create(null);
local.Object = Object;
local.Array = Array;
local.R... | cwe | CWE-674 | Python |
def create(request, comment_id):
comment = get_object_or_404(Comment, pk=comment_id)
form = FlagForm(
user=request.user,
comment=comment,
data=post_data(request))
if is_post(request) and form.is_valid():
form.save()
return redirect(request.POST.get('next', comment.ge... | cwe | CWE-601 | Python |
def check_credentials_permissions
return if Gem.win_platform? # windows doesn't write 0600 as 0600
return unless File.exist? credentials_path
existing_permissions = File.stat(credentials_path).mode & 0777
return if existing_permissions == 0600
alert_error <<-ERROR
Your gem push credentials file l... | cwe | CWE-502 | Ruby |
/* $OpenBSD: monitor_mm.c,v 1.21 2015/02/06 23:21:59 millert Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* 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. Redistr... | cwe | CWE-119 | C/C++ |
public function download(){
$this->checkLogin();
$this->checkAdmin();
set_time_limit(1000);
ini_set('memory_limit','500M');
$new_version = I("new_version") ;
$file_url = I("file_url") ;
$version_num = str_replace("v","",$new_version) ;
$showdoc_path = "..... | cwe | CWE-434 | PHP |
function _sendFile(fileRequested, req, res, stats) {
fs.open(fileRequested, "r", (err, fd) => {
if (err) (err.code === "ENOENT") ? _sendError(req, res, 404, "Path Not Found.") : _sendError(req, res, 500, err);
else {
access.info(`Sending: ${fileRequested}`);
const mime = conf.mimeTypes[path.extname(fileRequ... | cwe | CWE-79 | JavaScript |
/* 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-345 | C/C++ |
static int target_xcopy_locate_se_dev_e4(const unsigned char *dev_wwn,
struct se_device **found_dev)
{
struct xcopy_dev_search_info info;
int ret;
memset(&info, 0, sizeof(info));
info.dev_wwn = dev_wwn;
ret = target_for_each_device(target_xcopy_locate_se_dev_e4_iter, &info);
if (ret == 1) {
*found_dev = ... | cwe | CWE-22 | C/C++ |
ldns_str2rdf_str(ldns_rdf **rd, const char *str)
{
uint8_t *data;
size_t i, str_i, esc_i;
if (strlen(str) > 255) {
return LDNS_STATUS_INVALID_STR;
}
data = LDNS_XMALLOC(uint8_t, strlen(str) + 1);
if(!data) return LDNS_STATUS_MEM_ERR;
i = 1;
for (str_i = 0; str_i < strlen(str); str_i++) {
if (str[s... | cwe | CWE-415 | Unknown |
xmlDocPtr soap_xmlParseFile(const char *filename TSRMLS_DC)
{
xmlParserCtxtPtr ctxt = NULL;
xmlDocPtr ret;
zend_bool old_allow_url_fopen;
/*
xmlInitParser();
*/
old_allow_url_fopen = PG(allow_url_fopen);
PG(allow_url_fopen) = 1;
ctxt = xmlCreateFileParserCtxt(filename);
PG(allow_url_fopen) = old_allow_... | cwe | CWE-200 | Unknown |
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this fi... | cwe | CWE-74 | Java |
static int adis_update_scan_mode_burst(struct iio_dev *indio_dev,
const unsigned long *scan_mask)
{
struct adis *adis = iio_device_get_drvdata(indio_dev);
unsigned int burst_length;
u8 *tx;
/* All but the timestamp channel */
burst_length = (indio_dev->num_channels - 1) * sizeof(u16);
burst_length += adis->burs... | cwe | CWE-401 | C/C++ |
const cheerio = require('cheerio');
const { puppeteerGet, renderDesc } = require('./utils');
const config = require('@/config').value;
module.exports = async (ctx) => {
const pub = ctx.params.pub;
const jrn = ctx.params.jrn;
const sec = ctx.params.sec.split('+').join(' ');
const host = `https://${pub}.... | cwe | CWE-918 | JavaScript |
goto_tabpage(int n)
{
tabpage_T *tp = NULL; // shut up compiler
tabpage_T *ttp;
int i;
if (text_locked())
{
// Not allowed when editing the command line.
text_locked_msg();
return;
}
// If there is only one it can't work.
if (first_tabpage->tp_next == NULL)
{
if (n > 1)
... | cwe | CWE-476 | Unknown |
import { BehaviorSubject } from 'rxjs';
import { history, handleResponse } from '@/_helpers';
import config from 'config';
const currentUserSubject = new BehaviorSubject(JSON.parse(localStorage.getItem('currentUser')));
export const authenticationService = {
login,
logout,
signup,
updateCurrentUserDetails,
... | cwe | CWE-74 | JavaScript |
// Sandstorm - Personal Cloud Sandbox
// Copyright (c) 2016 Sandstorm Development Group, Inc. and contributors
// 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
//
/... | cwe | CWE-918 | JavaScript |
auth_request_want_skip_passdb(struct auth_request *request,
struct auth_passdb *passdb)
{
/* if mechanism is not supported, skip */
const char *const *mechs = passdb->passdb->mechanisms;
const char *const *username_filter = passdb->passdb->username_filter;
const char *username;
username = request->fields... | cwe | CWE-284 | Unknown |
decryptTopicPage(data) {
if (!data.currentRouteName?.startsWith("topic.")) {
return;
}
if (
!this.container ||
this.container.isDestroyed ||
this.container.isDestroying
) {
return;
}
const topicController = this.container.lookup("controller:topic");
const topi... | cwe | CWE-79 | JavaScript |
public function getTopTenData($count = PMF_NUMBER_RECORDS_TOPTEN, $categoryId = 0, $language = null)
{
global $sids;
$now = date('YmdHis');
$query =
' SELECT
fd.id AS id,
fd.lang AS lang,
fd.thema AS question,
fd.upd... | cwe | CWE-79 | PHP |
/*
Copyright 1996-2013 Han The Thanh <thanh@pdftex.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 2 of the License, or
(at your option) any later version.
This program is distri... | cwe | CWE-119 | C/C++ |
static int ssl_scan_serverhello_tlsext(SSL *s, unsigned char **p,
unsigned char *d, int n, int *al)
{
unsigned short length;
unsigned short type;
unsigned short size;
unsigned char *data = *p;
int tlsext_servername = 0;
int renegotiate_seen = 0;
# ifndef O... | cwe | CWE-190 | Unknown |
void reposition(int pos) { ptr = start + pos; } | cwe | CWE-122 | C/C++ |
/*
* libEtPan! -- a mail stuff library
*
* Copyright (C) 2001, 2005 - DINH Viet Hoa
* 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 a... | cwe | CWE-476 | C/C++ |
private def checkSessionId(
site: SiteBrief,
anySillySid: Opt[St],
anyFancySidPart12Maybe3: Opt[St],
anyFancySidPart4: Opt[St],
anyFancySidPart5: Opt[St],
dao: SessionSiteDaoMixin,
now: When,
expireIdleAfterMillis: i64): CheckSidResult = {
val hasFanc... | cwe | CWE-613 | JavaScript |
status_t SampleTable::setTimeToSampleParams(
off64_t data_offset, size_t data_size) {
if (mTimeToSample != NULL || data_size < 8) {
return ERROR_MALFORMED;
}
uint8_t header[8];
if (mDataSource->readAt(
data_offset, header, sizeof(header)) < (ssize_t)sizeof(header)) {
return ERROR_IO;
}
if (U3... | cwe | CWE-189 | C/C++ |
static int p54u_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct usb_device *udev = interface_to_usbdev(intf);
struct ieee80211_hw *dev;
struct p54u_priv *priv;
int err;
unsigned int i, recognized_pipes;
dev = p54_init_common(sizeof(*priv));
if (!dev) {
dev_err(&udev->dev, "(p54... | cwe | CWE-416 | Unknown |
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc.
*
* 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-200 | Java |
build_unc_path_to_root(const struct smb_vol *vol,
const struct cifs_sb_info *cifs_sb)
{
char *full_path, *pos;
unsigned int pplen = vol->prepath ? strlen(vol->prepath) + 1 : 0;
unsigned int unc_len = strnlen(vol->UNC, MAX_TREE_SIZE + 1);
full_path = kmalloc(unc_len + pplen + 1, GFP_KERNEL);
if (full_path == NUL... | cwe | CWE-189 | C/C++ |
i_alloc_byte_array(gs_memory_t * mem, uint num_elements, uint elt_size,
client_name_t cname)
{
gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem;
obj_header_t *obj;
#ifdef MEMENTO
if (Memento_failThisEvent())
return NULL;
#endif
obj = alloc_obj(imem, (ulong) num_elements... | cwe | CWE-190 | Unknown |
void Compute(OpKernelContext* ctx) override {
const Tensor& handle = ctx->input(0);
const string& name = handle.scalar<tstring>()();
Tensor val;
OP_REQUIRES_OK(ctx, ctx->session_state()->GetTensor(name, &val));
ctx->set_output(0, val);
} | cwe | CWE-476 | C/C++ |
struct r_bin_pe_addr_t *PE_(check_mingw)(RBinPEObj *pe) {
struct r_bin_pe_addr_t* entry;
bool sw = false;
ut8 b[1024];
size_t n = 0;
if (!pe || !pe->b) {
return 0LL;
}
entry = PE_(r_bin_pe_get_entrypoint) (pe);
ZERO_FILL (b);
if (r_buf_read_at (pe->b, entry->paddr, b, sizeof (b)) < 0) {
pe_printf ("Warning... | cwe | CWE-400 | C/C++ |
def initialize(json)
@params = YAML.load(json || '')
end | cwe | CWE-502 | Ruby |
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let args = set_command_line_args().get_matches();
env::set_var("RUST_LOG", "swhkd=warn");
if args.is_present("debug") {
env::set_var("RUST_LOG", "swhkd=trace");
}
env_logger::init();
log::trace!("Logger initialized.");
le... | cwe | CWE-770 | Rust |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.