code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
/*
* 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 struct block_device *ext3_blkdev_get(dev_t dev, struct super_block *sb)
{
struct block_device *bdev;
char b[BDEVNAME_SIZE];
bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, sb);
if (IS_ERR(bdev))
goto fail;
return bdev;
fail:
ext3_msg(sb, "error: failed to open journal device %s: %ld",
... | cwe | CWE-20 | Unknown |
/** BEGIN COPYRIGHT BLOCK
* Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
* Copyright (C) 2005 Red Hat, Inc.
* All rights reserved.
*
* License: GPL (version 3 or any later version).
* See LICENSE for details.
* END COPYRIGHT BLOCK **/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
/* ldbm_con... | cwe | CWE-203 | C/C++ |
/*
** $Id: ldebug.c $
** Debug Interface
** See Copyright Notice in lua.h
*/
#define ldebug_c
#define LUA_CORE
#include "lprefix.h"
#include <stdarg.h>
#include <stddef.h>
#include <string.h>
#include "lua.h"
#include "lapi.h"
#include "lcode.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lo... | cwe | CWE-787 | C/C++ |
nfa_regmatch(
nfa_regprog_T *prog,
nfa_state_T *start,
regsubs_T *submatch,
regsubs_T *m)
{
int result = FALSE;
size_t size = 0;
int flag = 0;
int go_to_nextline = FALSE;
nfa_thread_T *t;
nfa_list_T list[2];
int listidx;
nfa_list_T *thislist;
nfa_list_T *nextli... | cwe | CWE-416 | Unknown |
int sdma_init(struct hfi1_devdata *dd, u8 port)
{
unsigned this_idx;
struct sdma_engine *sde;
struct rhashtable *tmp_sdma_rht;
u16 descq_cnt;
void *curr_head;
struct hfi1_pportdata *ppd = dd->pport + port;
u32 per_sdma_credits;
uint idle_cnt = sdma_idle_cnt;
size_t num_engines = chip_sdma_engines(dd);
int ret... | cwe | CWE-401 | C/C++ |
bool asn1_read_ContextSimple(struct asn1_data *data, uint8_t num, DATA_BLOB *blob)
{
int len;
ZERO_STRUCTP(blob);
if (!asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(num))) return false;
len = asn1_tag_remaining(data);
if (len < 0) {
data->has_error = true;
return false;
}
*blob = data_blob(NULL, len);
if ((len !... | cwe | CWE-399 | Unknown |
static void ndpi_reset_packet_line_info(struct ndpi_packet_struct *packet) {
packet->parsed_lines = 0, packet->empty_line_position_set = 0, packet->host_line.ptr = NULL,
packet->host_line.len = 0, packet->referer_line.ptr = NULL, packet->referer_line.len = 0,
packet->content_line.ptr = NULL, packet->content_l... | cwe | CWE-787 | C/C++ |
void Compute(OpKernelContext* context) override {
const Tensor* reverse_index_map_t;
const Tensor* grad_values_t;
OP_REQUIRES_OK(context,
context->input("reverse_index_map", &reverse_index_map_t));
OP_REQUIRES_OK(context, context->input("grad_values", &grad_values_t));
const CPUD... | cwe | CWE-20 | C/C++ |
/**
* Copyright (c) 2006-2017, JGraph Ltd
* Copyright (c) 2006-2017, Gaudenz Alder
*/
(function()
{
/**
* Version
*/
EditorUi.VERSION = '@DRAWIO-VERSION@';
/**
* Overrides compact UI setting.
*/
EditorUi.compactUi = uiTheme != 'atlas';
/**
* Overrides default grid color for dark mode
*/
if (Edit... | cwe | CWE-79 | JavaScript |
void RenderFrameDevToolsAgentHost::UpdateFrameHost(
RenderFrameHostImpl* frame_host) {
if (frame_host == frame_host_) {
if (frame_host && !render_frame_alive_) {
render_frame_alive_ = true;
MaybeReattachToRenderFrame();
}
return;
}
if (frame_host && !ShouldCreateDevToolsForHost(frame_... | cwe | CWE-20 | C/C++ |
pdf_t *pdf_new(const char *name)
{
const char *n;
pdf_t *pdf;
pdf = calloc(1, sizeof(pdf_t));
if (name)
{
/* Just get the file name (not path) */
if ((n = strrchr(name, '/')))
++n;
else
n = name;
pdf->name = malloc(strlen(n) + 1);
... | cwe | CWE-787 | C/C++ |
bool Helper::getPartitionSizeInfo(const QString &partDevice, qint64 *used, qint64 *free, int *blockSize)
{
QProcess process;
QStringList env_list = QProcess::systemEnvironment();
env_list.append("LANG=C");
process.setEnvironment(env_list);
if (Helper::isMounted(partDevice)) {
process.start... | cwe | CWE-59 | C/C++ |
static int hso_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{
int mux, i, if_num, port_spec;
unsigned char port_mask;
struct hso_device *hso_dev = NULL;
struct hso_shared_int *shared_int;
struct hso_device *tmp_dev = NULL;
if (interface->cur_altsetting->desc.bInterfaceClass != 0x... | cwe | CWE-125 | Unknown |
libssh2_channel_eof(LIBSSH2_CHANNEL * channel)
{
LIBSSH2_SESSION *session;
LIBSSH2_PACKET *packet;
if(!channel)
return LIBSSH2_ERROR_BAD_USE;
session = channel->session;
packet = _libssh2_list_first(&session->packets);
while(packet) {
if(((packet->data[0] == SSH_MSG_CHANNEL_DA... | cwe | CWE-787 | Unknown |
from trac.core import *
from trac.util.datefmt import from_utimestamp, pretty_timedelta
from trac.versioncontrol import RepositoryManager
from trac.util.translation import _
from datetime import datetime
from time import time
import math
import re
class PortRepository(object):
def __init__(self, env, id):
... | cwe | CWE-89 | JavaScript |
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-369 | Unknown |
G&&(D.filename=G.getTitle());D.pagecount=null!=d.pages?d.pages.length:1;D.page=null!=d.currentPage?d.currentPage.getName():"";D.pagenumber=null!=d.pages&&null!=d.currentPage?mxUtils.indexOf(d.pages,d.currentPage)+1:1;return D};var O=g.getGlobalVariable;g.getGlobalVariable=function(D){var G=d.getCurrentFile();return"fil... | cwe | CWE-20 | JavaScript |
removeAllCookies(cb) {
this.idx = {};
return cb(null);
} | cwe | CWE-1321 | JavaScript |
const CuePoint* Cues::GetFirst() const {
if (m_cue_points == NULL)
return NULL;
if (m_count == 0)
return NULL;
#if 0
LoadCuePoint(); //init cues
const size_t count = m_count + m_preload_count;
if (count == 0) //weird
return NULL;
#endif
CuePoint* const* const pp = m_cue_points;
... | cwe | CWE-20 | C/C++ |
/*******************************************************************************
* 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 |
/* Copyright 2018 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-369 | C/C++ |
def _make_fc_map(self, source, target, full_copy):
copyflag = '' if full_copy else '-copyrate 0'
fc_map_cli_cmd = ('svctask mkfcmap -source %(src)s -target %(tgt)s '
'-autodelete %(copyflag)s' %
{'src': source,
'tgt': target,... | cwe | CWE-78 | Python |
module.exports = set;
/*
var obj1 = {};
set(obj1, 'a.aa.aaa', 4); // true
obj1; // {a: {aa: {aaa: 4}}}
var obj2 = {};
set(obj2, ['a', 'aa', 'aaa'], 4); // true
obj2; // {a: {aa: {aaa: 4}}}
var obj3 = {a: {aa: {aaa: 2}}};
set(obj3, 'a.aa.aaa', 3); // true
obj3; // {a: {aa: {aaa: 3}}}
// don't clo... | cwe | CWE-915 | JavaScript |
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2019 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute i... | cwe | CWE-79 | JavaScript |
package com.salesmanager.shop.admin.controller;
/**
* Interface contain constant for Controller.These constant will be used throughout
* sm-shop to providing constant values to various Controllers being used in the
* application.
* @author Umesh A
*
*/
public interface ControllerConstants
{
interface Tiles... | cwe | CWE-639 | Java |
for(var J=0;J<X.length;J++)if("label"!=X[J].nodeName){var T=mxUtils.trim(X[J].nodeValue.replace(/[\x00-\x1F\x7F-\x9F]|\s+/g," ")).toLowerCase();if(null==U&&(E&&0<=T.indexOf(u)||!E&&T.substring(0,u.length)===u)||null!=U&&U.test(T))return!0}}return!1}function d(){x&&L.value?(S.removeAttribute("disabled"),V.removeAttribut... | cwe | CWE-20 | JavaScript |
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/ory/fosite (interfaces: Client)
// Package internal is a generated GoMock package.
package internal
import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
fosite "github.com/ory/fosite"
)
// MockClient is a mock of Client interface
type... | cwe | CWE-287 | Go |
cJSON *cJSON_CreateInt( int64_t num )
{
cJSON *item = cJSON_New_Item();
if ( item ) {
item->type = cJSON_Number;
item->valuefloat = num;
item->valueint = num;
}
return item;
} | cwe | CWE-120 | C/C++ |
cifs_iovec_write(struct file *file, const struct iovec *iov,
unsigned long nr_segs, loff_t *poffset)
{
unsigned long nr_pages, i;
size_t copied, len, cur_len;
ssize_t total_written = 0;
loff_t offset;
struct iov_iter it;
struct cifsFileInfo *open_file;
struct cifs_tcon *tcon;
struct cifs_sb_info *cifs_... | cwe | CWE-119 | C/C++ |
# -*- coding: utf-8 -*-
# rdiffweb, A web interface to rdiff-backup repositories
# Copyright (C) 2012-2021 rdiffweb contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version ... | cwe | CWE-601 | Python |
}
void print_udta(GF_ISOFile *file, u32 track_number, Bool has_itags)
{
u32 i, count;
count = gf_isom_get_udta_count(file, track_number);
if (!count) return;
if (has_itags) {
for (i=0; i<count; i++) {
u32 type;
bin128 uuid;
gf_isom_get_udta_type(file, track_number, i+1, &type, &uuid);
if (type == ... | cwe | CWE-787 | C/C++ |
/* Copyright 2019 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-119 | C/C++ |
void PrintViewManager::OnShowScriptedPrintPreview(content::RenderFrameHost* rfh,
bool source_is_modifiable) {
DCHECK(print_preview_rfh_);
if (rfh != print_preview_rfh_)
return;
PrintPreviewDialogController* dialog_controller =
PrintPreviewDialogControll... | cwe | CWE-20 | C/C++ |
def editor(self, filename):
"""Spawn the default editor ($EDITOR env var)."""
if not os.getenv("EDITOR"):
raise exceptions.FatalError("unable to get an EDITOR environment "
"variable")
os.system("$EDITOR '{}'".format(filename)) | cwe | CWE-78 | Python |
xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt,
xmlXPathStepOpPtr op,
xmlNodeSetPtr set,
int contextSize,
int minPos,
int maxPos,
int hasNsNodes)
{
if (op->ch1 != -1) {
xmlXPathCompExprPtr comp = ctxt->comp;
if (comp->steps[op->ch1].... | cwe | CWE-415 | C/C++ |
/**
* Testing dockable windows.
*/
EditorUi.windowed = urlParams['windows'] != '0';
/**
* Code for the minimal UI theme.
*/
EditorUi.initMinimalTheme = function()
{
// Disabled in lightbox and chromeless mode
if (urlParams['lightbox'] == '1' || urlParams['chrome'] == '0' || typeof window.Format === 'undefined' |... | cwe | CWE-79 | JavaScript |
const got = require('@/utils/got');
const cheerio = require('cheerio');
const maxPages = 5;
module.exports = async (ctx) => {
const { subdomain } = ctx.params;
const shopUrl = `https://${subdomain}.booth.pm`;
let shopName;
const items = [];
for (let page = 1; page <= maxPages; page++) {
c... | cwe | CWE-918 | JavaScript |
package server
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"time"
"github.com/pkg/errors"
"github.com/usememos/memos/api"
"github.com/usememos/memos/common"
metric "github.com/usememos/memos/plugin/metrics"
"github.com/labstack/echo/v4"
)
const (
// The max file size is 32MB.
ma... | cwe | CWE-79 | Go |
int ext4_find_inline_data_nolock(struct inode *inode)
{
struct ext4_xattr_ibody_find is = {
.s = { .not_found = -ENODATA, },
};
struct ext4_xattr_info i = {
.name_index = EXT4_XATTR_INDEX_SYSTEM,
.name = EXT4_XATTR_SYSTEM_DATA,
};
int error;
if (EXT4_I(inode)->i_extra_isize == 0)
return 0;
error = ext4... | cwe | CWE-416 | Unknown |
dtls1_process_buffered_records(SSL *s)
{
pitem *item;
item = pqueue_peek(s->d1->unprocessed_rcds.q);
if (item)
{
/* Check if epoch is current. */
if (s->d1->unprocessed_rcds.epoch != s->d1->r_epoch)
return(1); /* Nothing to do. */
/* Process all... | cwe | CWE-119 | C/C++ |
check_symlinks(struct archive_write_disk *a)
{
#if !defined(HAVE_LSTAT)
/* Platform doesn't have lstat, so we can't look for symlinks. */
(void)a; /* UNUSED */
return (ARCHIVE_OK);
#else
char *pn;
char c;
int r;
struct stat st;
/*
* Guard against symlink tricks. Reject any archive entry whose
* destinatio... | cwe | CWE-20 | Unknown |
static gboolean prplcb_xfer_new_send_cb(gpointer data, gint fd, b_input_condition cond)
{
PurpleXfer *xfer = data;
struct im_connection *ic = purple_ic_by_pa(xfer->account);
struct prpl_xfer_data *px = xfer->ui_data;
PurpleBuddy *buddy;
const char *who;
buddy = purple_find_buddy(xfer->account, xfer->who);
who =... | cwe | CWE-476 | Unknown |
function set(part, value, fn) {
var url = this;
switch (part) {
case 'query':
if ('string' === typeof value && value.length) {
value = (fn || qs.parse)(value);
}
url[part] = value;
break;
case 'port':
url[part] = value;
if (!required(value, url.protocol)) {
... | cwe | CWE-639 | JavaScript |
CBINDInstallDlg::UpdateService(CString StartName) {
SC_HANDLE hSCManager;
SC_HANDLE hService;
if(m_toolsOnly)
return;
SetCurrent(IDS_OPEN_SCM);
hSCManager= OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (!hSCManager) {
MsgBox(IDS_ERR_OPEN_SCM, GetErrMessage());
return;
}
DWORD dwStart = SERVICE_D... | cwe | CWE-284 | 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-611 | Java |
/* radare - LGPL - Copyright 2011-2019 - earada, pancake */
#include <r_core.h>
#include <r_config.h>
#include "r_util.h"
#include "r_util/r_time.h"
#define is_in_range(at, from, sz) ((at) >= (from) && (at) < ((from) + (sz)))
#define VA_FALSE 0
#define VA_TRUE 1
#define VA_NOREBASE 2
#define LOAD_BSS_MALLOC ... | cwe | CWE-78 | C/C++ |
njs_generate_try_catch(njs_vm_t *vm, njs_generator_t *generator,
njs_parser_node_t *node)
{
njs_int_t ret;
njs_index_t exit_index;
njs_vmcode_finally_t *finally;
njs_generator_patch_t *patch;
njs_generator_block_t *block, *try_block;
njs_generator_try_ct... | cwe | CWE-703 | Unknown |
WORD32 ih264d_parse_bslice(dec_struct_t * ps_dec, UWORD16 u2_first_mb_in_slice)
{
dec_pic_params_t * ps_pps = ps_dec->ps_cur_pps;
dec_slice_params_t * ps_slice = ps_dec->ps_cur_slice;
dec_bit_stream_t * ps_bitstrm = ps_dec->ps_bitstrm;
UWORD8 u1_ref_idx_re_flag_lx;
UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_... | cwe | CWE-119 | C/C++ |
int ext4_check_blockref(const char *function, unsigned int line,
struct inode *inode, __le32 *p, unsigned int max)
{
__le32 *bref = p;
unsigned int blk;
if (ext4_has_feature_journal(inode->i_sb) &&
(inode->i_ino ==
le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_journal_inum)))
return 0;
while (bref < p... | cwe | CWE-703 | Unknown |
static int8_t parse_ext_option(uint16_t *dst, uint8_t **packet_data_pptr, uint8_t *packet_data_start_ptr, uint16_t packet_len, uint16_t *message_left)
{
uint16_t option_number = *dst;
if (option_number == 13) {
uint8_t option_ext;
int8_t read_result = sn_coap_parser_read_packet_u8(&option_ext,
... | cwe | CWE-190 | C/C++ |
long AudioTrack::Parse(Segment* pSegment, const Info& info,
long long element_start, long long element_size,
AudioTrack*& pResult) {
if (pResult)
return -1;
if (info.type != Track::kAudio)
return -1;
IMkvReader* const pReader = pSegment->m_pReader;
const Settings& s = info.settings;
assert(s.start >= 0);
... | cwe | CWE-20 | C/C++ |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-787 | C/C++ |
BOOL rdp_read_share_control_header(wStream* s, UINT16* length, UINT16* type, UINT16* channel_id)
{
if (Stream_GetRemainingLength(s) < 2)
return FALSE;
/* Share Control Header */
Stream_Read_UINT16(s, *length); /* totalLength */
/* If length is 0x8000 then we actually got a flow control PDU that we should ignore... | cwe | CWE-125 | Unknown |
function deleteEvent() {
var label = "";
var events = [];
if (listOfSelection) {
var nodes = listOfSelection.getSelectedRows();
if (nodes.length > 0) {
if (listOfSelection.parentNode == $("tasksList"))
label = _("taskDeleteConfirmation");
else
... | cwe | CWE-79 | JavaScript |
long ParseElementHeader(IMkvReader* pReader, long long& pos,
long long stop, long long& id,
long long& size) {
if (stop >= 0 && pos >= stop)
return E_FILE_FORMAT_INVALID;
long len;
id = ReadID(pReader, pos, len);
if (id < 0)
return E_FILE_FORMAT_INVALID;
pos += len; // consume id
if (stop >= 0 && pos >... | cwe | CWE-20 | C/C++ |
MathJax.Hub.Register.StartupHook("Begin",function(){for(var R=0;R<Editor.mathJaxQueue.length;R++)Editor.doMathJaxRender(Editor.mathJaxQueue[R])})}};Editor.MathJaxRender=function(R){"undefined"!==typeof MathJax&&"undefined"!==typeof MathJax.Hub?Editor.doMathJaxRender(R):Editor.mathJaxQueue.push(R)};Editor.MathJaxClear=f... | cwe | CWE-20 | JavaScript |
void PaymentRequest::CanMakePayment() {
if (observer_for_testing_)
observer_for_testing_->OnCanMakePaymentCalled();
if (!delegate_->GetPrefService()->GetBoolean(kCanMakePaymentEnabled) ||
!state_) {
CanMakePaymentCallback(/*can_make_payment=*/false);
} else {
state_->CanMakePayment(
... | cwe | CWE-189 | C/C++ |
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2019 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute i... | cwe | CWE-79 | JavaScript |
package org.pac4j.oidc.profile.creator;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.JWSAlgorithm;
import com.nimbusds.jose.proc.BadJOSEException;
import com.nimbusds.jwt.JWT;
import com.nimbusds.oauth2.sdk.auth.Secret;
import com.nimbusds.oauth2.sdk.id.ClientID;
import com.nimbusds.openid.connect.... | cwe | CWE-347 | Java |
TfLiteStatus HardSwishPrepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_STATUS(GenericPrepare(context, node));
TfLiteTensor* output = GetOutput(context, node, 0);
if (output->type == kTfLiteUInt8 || output->type == kTfLiteInt8) {
HardSwishData* data = static_cast<HardSwishData*>(node->user_d... | cwe | CWE-787 | C/C++ |
def _put_validation_file(self, domain, file_path, file_name, content):
"""Put file to the domain with validation content"""
request = {'packet': {'site': {'get': [
{'filter': {'name': domain}},
{'dataset': {'hosting': {}}},
]}}}
response = self.plesk_api_client.re... | cwe | CWE-377 | Python |
static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
int offset, size_t count)
{
int len = iov_length(from, count) - offset;
int copy = skb_headlen(skb);
int size, offset1 = 0;
int i = 0;
/* Skip over from offset */
while (count && (offset >= from->iov_len)) {
offset -= from->... | cwe | CWE-119 | C/C++ |
/*
* This file is part of the KeepKey project.
*
* Copyright (C) 2021 ShapeShift
*
* 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 3 of the License, or
* (at your o... | cwe | CWE-120 | C/C++ |
public function destroy(Appointment $appointment)
{
if (!auth()->user()->can("appointment-create")) {
return response("Access denied", 403);
}
$deleted = $appointment->delete();
if ($deleted) {
return response("Success");
}
return response("Er... | cwe | CWE-862 | PHP |
def self.applied_paid_hlds(user_id, start_date, end_date)
SqlHelper.validate_token([user_id, start_date, end_date])
sql = "SELECT COUNT(*) FROM timecards WHERE user_id = #{user_id} AND date >= '#{start_date}' AND date <= '#{end_date}'"
sum = 0.0
self.workcodes.each do |key, params|
paidhld_rate... | cwe | CWE-89 | Ruby |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
# This file is part of qutebrowser.
#
# qutebrowser 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 So... | cwe | CWE-88 | Python |
// Ogg Vorbis audio decoder - v1.16 - public domain
// http://nothings.org/stb_vorbis/
//
// Original version written by Sean Barrett in 2007.
//
// Originally sponsored by RAD Game Tools. Seeking implementation
// sponsored by Phillip Bennefall, Marc Andersen, Aaron Baker,
// Elias Software, Aras Pranckevicius, and Se... | cwe | CWE-125 | C/C++ |
static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family)
{
u16 prev_family;
int i;
if (nr > XFRM_MAX_DEPTH)
return -EINVAL;
prev_family = family;
for (i = 0; i < nr; i++) {
/* We never validated the ut->family value, so many
* applications simply leave it at zero. The check was
* never... | cwe | CWE-416 | Unknown |
func (f *ScmpFilter) addRuleGeneric(call ScmpSyscall, action ScmpAction, exact bool, conds []ScmpCondition) error {
f.lock.Lock()
defer f.lock.Unlock()
if !f.valid {
return errBadFilter
}
if len(conds) == 0 {
if err := f.addRuleWrapper(call, action, exact, nil); err != nil {
return err
}
} else {
// ... | cwe | CWE-20 | Go |
$_result[$_key] = preg_replace("/<>'\"\[\]{}:;/", "", $_value);
}
$result = $_result;
} else {
$_result = strip_tags($arr[$key]);
$result = preg_replace("/<>'\"\[\]{}:;/", "", $_result);
}
} else {
$result = $def;
}
return $result;
} | cwe | CWE-89 | PHP |
foreach ($project_templates as $project_template) {
if ((int) $project_template->getGroupId() === \Project::ADMIN_PROJECT_ID) {
continue;
}
$company_templates[] = new CompanyTemplate($project_template, $this->glyph_finder);
} | cwe | CWE-200 | PHP |
/*
* GPAC - Multimedia Framework C SDK
*
* Author: Romain Bouqueau, Jean Le Feuvre
* Copyright (c) Romain Bouqueau 2012- Telecom Paris 2019-
* All rights reserved
*
* Note: this development was kindly sponsorized by Vizion'R (http://vizionr.com)
*
* This file is part of GPAC / ISO Media File... | cwe | CWE-119 | C/C++ |
INST_HANDLER (cpse) { // CPSE Rd, Rr
int r = (buf[0] & 0xf) | ((buf[1] & 0x2) << 3);
int d = ((buf[0] >> 4) & 0xf) | ((buf[1] & 0x1) << 4);
RAnalOp next_op;
avr_op_analyze (anal,
&next_op,
op->addr + op->size, buf + op->size, len - op->size,
cpu);
r_strbuf_fini (&next_op.esil);
op->jump = op->addr + ... | cwe | CWE-908 | C/C++ |
"""
This module defines a built-in contrib module that enables terminal embedding
within a slide.
"""
from marshmallow import fields, Schema
import os
import re
import shlex
import signal
import urwid
import yaml
import lookatme.render
from lookatme.exceptions import IgnoredByContrib
import lookatme.config
class ... | cwe | CWE-78 | Python |
static int fts3SelectLeaf(
Fts3Table *p, /* Virtual table handle */
const char *zTerm, /* Term to select leaves for */
int nTerm, /* Size of term zTerm in bytes */
const char *zNode, /* Buffer containing segment interior node */
int nNode, ... | cwe | CWE-908 | Unknown |
sctp_chunk_length_valid(struct sctp_chunk *chunk,
__u16 required_length)
{
__u16 chunk_length = ntohs(chunk->chunk_hdr->length);
if (unlikely(chunk_length < required_length))
return 0;
return 1;
} | cwe | CWE-399 | C/C++ |
void ndpi_search_h323(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{
struct ndpi_packet_struct *packet = &flow->packet;
u_int16_t dport = 0, sport = 0;
NDPI_LOG_DBG(ndpi_struct, "search H323\n");
/*
The TPKT protocol is used by ISO 8072 (on port 102)
and H.323. So t... | cwe | CWE-125 | C/C++ |
Status AuthorizationManager::_initializeUserFromPrivilegeDocument(User* user,
const BSONObj& privDoc) {
V2UserDocumentParser parser;
std::string userName = parser.extractUserNameFromUserDocument(privDoc);
if (userName != user->getName().getUs... | cwe | CWE-613 | Unknown |
const selectUser = (data,cb)=>{
const sqlQuery = `SELECT email,first_name,last_name from users WHERE email='${data.email}'`;
client.query(sqlQuery,(err,result)=>{
cb(err,result);
});
}; | cwe | CWE-89 | JavaScript |
/* mqtt_client.c
*
* Copyright (C) 2006-2021 wolfSSL Inc.
*
* This file is part of wolfMQTT.
*
* wolfMQTT 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... | cwe | CWE-787 | C/C++ |
def __post_init__(self, title: str) -> None: # type: ignore
super().__post_init__()
reference = Reference.from_ref(title)
dedup_counter = 0
while reference.class_name in _existing_enums:
existing = _existing_enums[reference.class_name]
if self.values == existing.... | cwe | CWE-94 | Python |
v8::Local<v8::Object> V8InjectedScriptHost::create(v8::Local<v8::Context> context, V8InspectorImpl* inspector)
{
v8::Isolate* isolate = inspector->isolate();
v8::Local<v8::Object> injectedScriptHost = v8::Object::New(isolate);
v8::Local<v8::External> debuggerExternal = v8::External::New(isolate, inspect... | cwe | CWE-79 | C/C++ |
long do_msgsnd(int msqid, long mtype, void __user *mtext,
size_t msgsz, int msgflg)
{
struct msg_queue *msq;
struct msg_msg *msg;
int err;
struct ipc_namespace *ns;
ns = current->nsproxy->ipc_ns;
if (msgsz > ns->msg_ctlmax || (long) msgsz < 0 || msqid < 0)
return -EINVAL;
if (mtype < 1)
return -EINVAL;
... | cwe | CWE-703 | 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-20 | Python |
/*
* 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 wp_validate_redirect($location, $default = '') {
$location = trim( $location );
// browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'
if ( substr($location, 0, 2) == '//' )
$location = 'http:' . $location;
// In php 5 parse_url may fail if the URL query pa... | cwe | CWE-20 | PHP |
*/
int re_yyget_column (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if (! YY_CURRENT_BUFFER)
return 0;
return yycolumn; | cwe | CWE-125 | Unknown |
// Copyright (C) 2007 Manu Garg.
// Author: Manu Garg <manugarg@gmail.com>
//
// pacparser is a library that provides methods to parse proxy auto-config
// (PAC) files. Please read README file included with this package for more
// information about this library.
//
// pacparser is free software; you can redistribute i... | cwe | CWE-120 | C/C++ |
func HTTP(c *HTTPContext) {
for _, route := range routes {
reqPath := strings.ToLower(c.Req.URL.Path)
m := route.re.FindStringSubmatch(reqPath)
if m == nil {
continue
}
// We perform check here because route matched in cmd/web.go is wider than needed,
// but we only want to output this message only if ... | cwe | CWE-22 | Go |
Comments.init = function(params, callback) {
var app = params.router,
middleware = params.middleware,
controllers = params.controllers;
fs.readFile(path.resolve(__dirname, './public/templates/comments/comments.tpl'), function (err, data) {
Comments.template = data.toString();
});
app.get('/comment... | cwe | CWE-352 | JavaScript |
'use strict';
const metavm = require('metavm');
const getValue = (target, prop) => {
if (prop === 'Math') return Math;
const { expressions, data } = target;
if (!expressions.has(prop)) return data.get(prop);
const expression = expressions.get(prop);
return expression();
};
const getCell = (target, prop) =>... | cwe | CWE-94 | JavaScript |
function checkProp(value, schema, path,i){
var l;
path += path ? typeof i == 'number' ? '[' + i + ']' : typeof i == 'undefined' ? '' : '.' + i : i;
function addError(message){
errors.push({property:path,message:message});
}
if((typeof schema != 'object' || schema instanceof Array) && (path || typeof sche... | cwe | CWE-1321 | JavaScript |
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include <zlib.h>
#include <openssl/ssl.h>
#ifndef WIN32
#else
#include <stdlib.h>
#include <vc_compat.h>
#endif
#include "lsquic_int_types.h"
#include "lsquic_crypt... | cwe | CWE-476 | C/C++ |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-119 | C/C++ |
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* 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.apach... | cwe | CWE-287 | Java |
/* 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-20 | Python |
package io.dropwizard.validation.selfvalidating;
import com.fasterxml.classmate.AnnotationConfiguration;
import com.fasterxml.classmate.AnnotationInclusion;
import com.fasterxml.classmate.MemberResolver;
import com.fasterxml.classmate.ResolvedTypeWithMembers;
import com.fasterxml.classmate.TypeResolver;
import com.fas... | cwe | CWE-74 | Java |
__global__ void UnsortedSegmentCustomKernel(const Index input_outer_dim_size,
const Index inner_dim_size,
const Index output_outer_dim_size,
const Index* segment_ids,
... | cwe | CWE-681 | C/C++ |
static void request_key_auth_describe(const struct key *key,
struct seq_file *m)
{
struct request_key_auth *rka = key->payload.data[0];
seq_puts(m, "key:");
seq_puts(m, key->description);
if (key_is_instantiated(key))
seq_printf(m, " pid:%d ci:%zu", rka->pid, rka->callout_len);
} | cwe | CWE-20 | Unknown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.