code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
/**
* @preserve date-and-time.js (c) KNOWLEDGECODE | MIT
*/
(function (global) {
'use strict';
var date = {},
locales = {},
plugins = {},
lang = 'en',
_res = {
MMMM: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', ... | cwe | CWE-400 | JavaScript |
/*
* Copyright (c) 2009-2012, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2009-2012, Pieter Noordhuis <pcnoordhuis at gmail dot com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following condition... | cwe | CWE-190 | C/C++ |
ambsdtar_build_argv(
application_argument_t *argument,
char *timestamps,
char **file_exclude,
char **file_include,
int command)
{
int nb_exclude = 0;
int nb_include = 0;
char *dirname;
char tmppath[PATH_MAX];
GPtrArray *argv_ptr = g_ptr_array_new();
... | cwe | CWE-264 | Unknown |
static void __exit fini_umd(void)
{
bpf_preload_ops = NULL;
/* kill UMD in case it's still there due to earlier error */
kill_pid(umd_ops.info.tgid, SIGKILL, 1);
umd_ops.info.tgid = NULL;
umd_unload_blob(&umd_ops.info);
} | cwe | CWE-401 | Unknown |
ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size)
{
struct inode *inode = d_inode(entry);
struct fuse_mount *fm = get_fuse_mount(inode);
FUSE_ARGS(args);
struct fuse_getxattr_in inarg;
struct fuse_getxattr_out outarg;
ssize_t ret;
if (!fuse_allow_current_process(fm->fc))
return -EACCES;
... | cwe | CWE-459 | Unknown |
static jpc_enc_tcmpt_t *tcmpt_create(jpc_enc_tcmpt_t *tcmpt, jpc_enc_cp_t *cp,
jas_image_t *image, jpc_enc_tile_t *tile)
{
uint_fast16_t cmptno;
uint_fast16_t rlvlno;
jpc_enc_rlvl_t *rlvl;
uint_fast32_t tlx;
uint_fast32_t tly;
uint_fast32_t brx;
uint_fast32_t bry;
uint_fast32_t cmpttlx;
uint_fast32_t cmpttly... | cwe | CWE-189 | Unknown |
"""Part database model definitions."""
from __future__ import annotations
import decimal
import hashlib
import logging
import os
from datetime import datetime
from decimal import Decimal, InvalidOperation
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.core.... | cwe | CWE-400 | Python |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input_tensor = GetInput(context, node, 0);
const TfLiteTensor* padding_matrix = GetInput(context, node, 1);
TfLiteTensor* output_tensor = GetOutput(context, node, 0);
TF_LITE_ENSURE_EQ(context, NumDimensions(padding_matrix), 2... | cwe | CWE-787 | C/C++ |
vips_malloc( VipsObject *object, size_t size )
{
void *buf;
buf = g_malloc( size );
if( object ) {
g_signal_connect( object, "postclose",
G_CALLBACK( vips_malloc_cb ), buf );
object->local_memory += size;
}
return( buf );
} | cwe | CWE-908 | C/C++ |
static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
{
hdlc_device *hdlc = dev_to_hdlc(frad);
pvc_device *pvc;
struct net_device *dev;
int used;
if ((pvc = add_pvc(frad, dlci)) == NULL) {
netdev_warn(frad, "Memory squeeze on fr_add_pvc()\n");
return -ENOBUFS;
}
if (*get_dev_p(pvc, ty... | cwe | CWE-264 | Unknown |
- (URLAction *)updateUnderlinedURLs:(NSEvent *)event {
URLAction *action = nil;
if (([event modifierFlags] & NSCommandKeyMask) && (self.window.isKeyWindow ||
[iTermAdvancedSettingsModel cmdClickWhenInactiveInvokesSemanticHistory])) {
NSPoint screenP... | cwe | CWE-200 | Objective-C |
main(int argc, char *argv[])
{
int c;
size_t i;
int action = 0, didsomefiles = 0, errflg = 0;
int flags = 0, e = 0;
struct magic_set *magic = NULL;
int longindex;
const char *magicfile = NULL; /* where the magic is */
/* makes islower etc work for other langs */
#ifdef HAVE_SETLOCALE
(void)setlocale(LC_CTYPE... | cwe | CWE-399 | Unknown |
static ssize_t aio_read(struct kiocb *req, const struct iocb *iocb,
bool vectored, bool compat)
{
struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs;
struct iov_iter iter;
struct file *file;
ssize_t ret;
ret = aio_prep_rw(req, iocb);
if (ret)
return ret;
file = req->ki_filp;
ret = -EBADF;
if (u... | cwe | CWE-416 | Unknown |
package config
import (
"context"
"crypto/sha256"
"os"
"sync"
"github.com/fsnotify/fsnotify"
"github.com/google/uuid"
"github.com/rs/zerolog"
"github.com/pomerium/pomerium/internal/fileutil"
"github.com/pomerium/pomerium/internal/log"
"github.com/pomerium/pomerium/internal/netutil"
"github.com/pomerium/po... | cwe | CWE-200 | Go |
/**
* @file subscription.c common subscription handling
*
* Copyright (C) 2003-2021 Lars Windolf <lars.windolf@gmx.de>
*
* 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 ... | cwe | CWE-78 | C/C++ |
static ssize_t clear_refs_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct task_struct *task;
char buffer[PROC_NUMBUF];
struct mm_struct *mm;
struct vm_area_struct *vma;
enum clear_refs_types type;
struct mmu_gather tlb;
int itype;
int rv;
memset(buffer, 0, sizeof(buff... | cwe | CWE-362 | C/C++ |
def edit
# give an error message is instructor have not set the time zone.
if current_user.timezonepref.nil?
flash.now[:error] = "You have not specified your preferred timezone yet. Please do this before you set up the deadlines."
end
@topics = SignUpTopic.find_by_sql("select * from sign_up_topics... | cwe | CWE-89 | Ruby |
protected BigInteger chooseRandomPrime(int bitlength, BigInteger e, BigInteger sqrdBound)
{
for (int i = 0; i != 5 * bitlength; i++)
{
BigInteger p = new BigInteger(bitlength, 1, param.getRandom());
if (p.mod(e).equals(ONE))
{
continue;
... | cwe | CWE-327 | Java |
function MAX_adRenderImageBeacon($logUrl, $beaconId = 'beacon', $userAgent = null)
{
if (!isset($userAgent) && isset($_SERVER['HTTP_USER_AGENT'])) {
$userAgent = $_SERVER['HTTP_USER_AGENT'];
}
$beaconId .= '_{random}';
// Add beacon image for logging
if (isset($userAgent) && preg_match("#Moz... | cwe | CWE-79 | PHP |
QString Helper::temporaryMountDevice(const QString &device, const QString &name, bool readonly)
{
QString mount_point = mountPoint(device);
if (!mount_point.isEmpty())
return mount_point;
mount_point = "%1/.%2/mount/%3";
const QStringList &tmp_paths = QStandardPaths::standardLocations(QStandar... | cwe | CWE-61 | C/C++ |
int _pam_parse(int argc, const char **argv) {
int ctrl = 0;
const char *current_secret = NULL;
/* otherwise the list will grow with each call */
memset(tac_srv, 0, sizeof(tacplus_server_t) * TAC_PLUS_MAXSERVERS);
memset(&tac_srv_addr, 0, sizeof(struct addrinfo) * TAC_PLUS_MAXSERVERS);
memset(&t... | cwe | CWE-532 | C/C++ |
/*
* OpenVPN -- An application to securely tunnel IP networks
* over a single TCP/UDP port, with support for SSL/TLS-based
* session authentication and key exchange,
* packet encryption, packet authentication, and
* packet compression.
*
* Copyright (C) 2002-2018... | cwe | CWE-287 | C/C++ |
void CoordinatorImpl::UnregisterClientProcess(
mojom::ClientProcess* client_process) {
QueuedRequest* request = GetCurrentRequest();
if (request != nullptr) {
auto it = request->pending_responses.begin();
while (it != request->pending_responses.end()) {
std::set<QueuedRequest::PendingResponse>::it... | cwe | CWE-416 | C/C++ |
static inline int unuse_pmd_range(struct vm_area_struct *vma, pud_t *pud,
unsigned long addr, unsigned long end,
swp_entry_t entry, struct page *page)
{
pmd_t *pmd;
unsigned long next;
int ret;
pmd = pmd_offset(pud, addr);
do {
next = pmd_addr_end(addr, end);
if (unlikely(pmd_trans_huge(*pmd)))
... | cwe | CWE-264 | C/C++ |
0>M?(H=M*V.width,M=0):1<M&&(H=(M-1)*V.width,M=1);0>F?(S=F*V.height,F=0):1<F&&(S=(F-1)*V.height,F=1);return{x:M,y:F,dx:parseInt(H),dy:parseInt(S)}}function k(){if(1==p.getSelectionCount()){var F=p.getSelectionCell();F=g(F);D.value=100*F.x;P.value=100*F.y;G.value=F.dx;K.value=F.dy;C.style.visibility=""}else C.style.visib... | cwe | CWE-20 | JavaScript |
njs_vm_start(njs_vm_t *vm)
{
njs_int_t ret;
ret = njs_module_load(vm);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
}
ret = njs_vmcode_interpreter(vm, vm->start);
return (ret == NJS_ERROR) ? NJS_ERROR : NJS_OK;
} | cwe | CWE-416 | Unknown |
readfile(
char_u *fname,
char_u *sfname,
linenr_T from,
linenr_T lines_to_skip,
linenr_T lines_to_read,
exarg_T *eap, /* can be NULL! */
int flags)
{
int fd = 0;
int newfile = (flags & READ_NEW);
int check_readonly;
int filtering = (flags & READ_FILTER);
int read_... | cwe | CWE-668 | C/C++ |
ieee802_15_4_if_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, const u_char *p)
{
u_int caplen = h->caplen;
int hdrlen;
uint16_t fc;
uint8_t seq;
if (caplen < 3) {
ND_PRINT((ndo, "[|802.15.4] %x", caplen));
return caplen;
}
fc = EXTRACT_LE_16BITS(p);
hdrlen = ... | cwe | CWE-125 | C/C++ |
function processUrl(url: string): void {
if (!global.mainWindow) return;
console.log("Handling link: ", url);
global.mainWindow.loadURL(url.replace(PROTOCOL, "vector://"));
} | cwe | CWE-416 | JavaScript |
NO_INLINE JsVar *jspeStatement() {
#ifdef USE_DEBUGGER
if (execInfo.execute&EXEC_DEBUGGER_NEXT_LINE &&
lex->tk!=';' &&
JSP_SHOULD_EXECUTE) {
lex->tokenLastStart = jsvStringIteratorGetIndex(&lex->tokenStart.it)-1;
jsiDebuggerLoop();
}
#endif
if (lex->tk==LEX_ID ||
lex->tk==LEX_INT ||
... | cwe | CWE-125 | Unknown |
void WebGLRenderingContextBase::TexImageHelperHTMLVideoElement(
const SecurityOrigin* security_origin,
TexImageFunctionID function_id,
GLenum target,
GLint level,
GLint internalformat,
GLenum format,
GLenum type,
GLint xoffset,
GLint yoffset,
GLint zoffset,
HTMLVideoElement* ... | cwe | CWE-125 | C/C++ |
def build_textcaptcha_config(options)
if options.is_a?(Hash)
options
else
YAML.load(ERB.new(read_textcaptcha_config).result)[Rails.env]
end
rescue StandardError
raise ArgumentError, "could not find any textcaptcha options, in config/textcaptcha.yml or model - run rake textcap... | cwe | CWE-502 | Ruby |
VP9PictureToVaapiDecodeSurface(const scoped_refptr<VP9Picture>& pic) {
VaapiVP9Picture* vaapi_pic = pic->AsVaapiVP9Picture();
CHECK(vaapi_pic);
return vaapi_pic->dec_surface();
} | cwe | CWE-362 | C/C++ |
Ra,"geMenuItem");null!=Na?(Ra.style.backgroundImage="url("+Na+")",Ra.style.backgroundPosition="center center",Ra.style.backgroundRepeat="no-repeat",Ra.style.backgroundSize="24px 24px",Ra.style.width="34px",Ra.innerHTML=""):ya||(Ra.style.backgroundImage="url("+mxWindow.prototype.normalizeImage+")",Ra.style.backgroundPos... | cwe | CWE-94 | JavaScript |
activate_desktop_file (ActivateParameters *parameters,
NautilusFile *file)
{
ActivateParametersDesktop *parameters_desktop;
char *primary, *secondary, *display_name;
GtkWidget *dialog;
GdkScreen *screen;
char *uri;
screen = gtk_widget_get_screen (GTK_WIDGET (paramet... | cwe | CWE-20 | C/C++ |
njs_typed_array_alloc(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_bool_t zeroing, njs_object_type_t type)
{
double num;
int64_t i, length;
uint32_t element_size;
uint64_t size, offset;
njs_int_t ret;
njs_value_t *val... | cwe | CWE-476 | Unknown |
EditorUi.prototype.updateTabContainer=function(){null!=this.tabContainer&&(this.tabContainer.style.right="70px",this.diagramContainer.style.bottom="1"==urlParams.sketch?"0px":this.tabContainerHeight+"px");e.apply(this,arguments)};var g=EditorUi.prototype.updateActionStates;EditorUi.prototype.updateActionStates=function... | cwe | CWE-94 | JavaScript |
static Image *ReadXBMImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
char
buffer[MagickPathExtent],
name[MagickPathExtent];
Image
*image;
int
c;
MagickBooleanType
status;
register ssize_t
i,
x;
register Quantum
*q;
register unsigned char
*p;
short... | cwe | CWE-200 | C/C++ |
static void *seq_buf_alloc(unsigned long size)
{
return kvmalloc(size, GFP_KERNEL_ACCOUNT);
} | cwe | CWE-787 | C/C++ |
$id = $node->getId();
if (empty($this->checkedNodes[$id])) {
$searchKey = array_search($id, $this->currentPath);
$this->currentPath[] = $id;
if (false !== $searchKey) {
throw new ServiceCircularReferenceException($id, array_slice($this->c... | cwe | CWE-89 | JavaScript |
long SegmentInfo::Parse() {
assert(m_pMuxingAppAsUTF8 == NULL);
assert(m_pWritingAppAsUTF8 == NULL);
assert(m_pTitleAsUTF8 == NULL);
IMkvReader* const pReader = m_pSegment->m_pReader;
long long pos = m_start;
const long long stop = m_start + m_size;
m_timecodeScale = 1000000;
m_duration = -1;
while (p... | cwe | CWE-20 | 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-787 | Unknown |
addChar(char c, Lineprop mode)
#endif
{
Lineprop m = CharEffect(mode);
#ifdef USE_M17N
char c = *p;
if (mode & PC_WCHAR2)
return;
#endif
do_effects(m);
if (mode & PC_SYMBOL) {
char **symbol;
#ifdef USE_M17N
int w = (mode & PC_KANJI) ? 2 : 1;
c = ((char)wtf_get_code((wc_uchar *) p) & 0x7f) - SY... | cwe | CWE-119 | Unknown |
userauth_keyboard_interactive(LIBSSH2_SESSION * session,
const char *username,
unsigned int username_len,
LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC((*response_callback)))
{
unsigned char *s;
int rc;
static const unsigned ... | cwe | CWE-787 | Unknown |
static void scsi_write_data(SCSIRequest *req)
{
SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req);
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
uint32_t n;
/* No data transfer may already be in progress */
assert(r->req.aiocb == NULL);
if (r->req.cmd.mode != SCSI_XFER_TO_DEV)... | cwe | CWE-119 | 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 |
send_fprtime_if_not_null (ctrl_t ctrl, const char *keyword,
int number, const unsigned char *stamp)
{
char numbuf1[50], numbuf2[50];
unsigned long value;
value = (stamp[0] << 24) | (stamp[1]<<16) | (stamp[2]<<8) | stamp[3];
if (!value)
return;
sprintf (numbuf1, "%d", number);
... | cwe | CWE-20 | Unknown |
for(ca=la=0;ca<ta.length;ca++)if(0<ta[ca].length){ka=ra[ta[ca]];var La={};Ja=[];if(null!=ka)for(qa=0;qa<ka.length;qa++)na=ka[qa],0==la==(null==aa[na.url])&&(La[na.url]=!0,Ja.push(na));aa=La;la++}0==Ja.length?ha.innerHTML=mxResources.get("noResultsFor",[ia]):B(Ja,!0)}}function H(ia){if(ba!=ia||P!=da)A(),Aa.scrollTop=0,e... | cwe | CWE-94 | JavaScript |
/******************************************************************************
*
* Purpose: Implementation of the CPCIDSKBinarySegment class.
*
******************************************************************************
* Copyright (c) 2010
* PCI Geomatics, 90 Allstate Parkway, Markham, Ontario, Canada.
*
... | cwe | CWE-787 | C/C++ |
static int set_evtchn_to_irq(evtchn_port_t evtchn, unsigned int irq)
{
unsigned row;
unsigned col;
if (evtchn >= xen_evtchn_max_channels())
return -EINVAL;
row = EVTCHN_ROW(evtchn);
col = EVTCHN_COL(evtchn);
if (evtchn_to_irq[row] == NULL) {
/* Unallocated irq entries return -1 anyway */
if (irq == -1)
... | cwe | CWE-362 | C/C++ |
static int __init cpia2_init(void)
{
LOG("%s v%s\n",
ABOUT, CPIA_VERSION);
check_parameters();
cpia2_usb_init();
return 0;
} | cwe | CWE-416 | 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-862 | Java |
void luaT_getvarargs (lua_State *L, CallInfo *ci, StkId where, int wanted) {
int i;
int nextra = ci->u.l.nextraargs;
if (wanted < 0) {
wanted = nextra; /* get all extra arguments available */
checkstackp(L, nextra, where); /* ensure stack space */
L->top = where + nextra; /* next instruction will n... | cwe | CWE-125 | Unknown |
state_index (struct dfa *d, position_set const *s, int context)
{
int hash = 0;
int constraint;
int i, j;
for (i = 0; i < s->nelem; ++i)
hash ^= s->elems[i].index + s->elems[i].constraint;
/* Try to find a state that exactly matches the proposed one. */
for (i = 0; i < d->sindex; ++i)
{
if (... | cwe | CWE-189 | Unknown |
package rke2
import (
"context"
"errors"
"fmt"
"regexp"
"sort"
"strings"
"time"
"github.com/rancher/channelserver/pkg/model"
provv1 "github.com/rancher/rancher/pkg/apis/provisioning.cattle.io/v1"
rkev1 "github.com/rancher/rancher/pkg/apis/rke.cattle.io/v1"
"github.com/rancher/rancher/pkg/apis/rke.cattle.io... | cwe | CWE-331 | Go |
lys_deviation_free(struct lys_module *module, struct lys_deviation *dev,
void (*private_destructor)(const struct lys_node *node, void *priv))
{
int i, j, k;
struct ly_ctx *ctx;
struct lys_node *next, *elem;
ctx = module->ctx;
lydict_remove(ctx, dev->target_name);
lydict_remo... | cwe | CWE-617 | Unknown |
function setStageHeadline(title) {
if (getUtility().isUndefinedOrNull(title)) {
title = buildTitleByFormElement();
}
$(getHelper().getDomElementDataIdentifierSelector('stageHeadline')).html(title);
} | cwe | CWE-79 | JavaScript |
function prepareInputForUpdate($input) {
global $CFG_GLPI;
// Unset _no_history to not save it as a configuration value
unset($input['_no_history']);
// Update only an item
if (isset($input['context'])) {
return $input;
}
// Process configuration for plugins
i... | cwe | CWE-327 | PHP |
// SPDX-License-Identifier: GPL-2.0+
//
// Freescale i.MX7ULP LPSPI driver
//
// Copyright 2016 Freescale Semiconductor, Inc.
// Copyright 2018 NXP Semiconductors
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
#include <linux/er... | cwe | CWE-400 | C/C++ |
MagickExport Image *MeanShiftImage(const Image *image,const size_t width,
const size_t height,const double color_distance,ExceptionInfo *exception)
{
#define MaxMeanShiftIterations 100
#define MeanShiftImageTag "MeanShift/Image"
CacheView
*image_view,
*mean_view,
*pixel_view;
Image
*mean_image... | cwe | CWE-369 | C/C++ |
char* HexOutStream::binToHexStr(const char* data, int length) {
char* buffer = new char[length*2+1];
for (int i=0; i<length; i++) {
buffer[i*2] = intToHex((data[i] >> 4) & 15);
buffer[i*2+1] = intToHex((data[i] & 15));
if (!buffer[i*2] || !buffer[i*2+1]) {
delete [] buffer;
return 0;
}
... | cwe | CWE-122 | C/C++ |
def actions
if params[:media_action] != 'crop_url'
authorize! :manage, :media
end
params[:folder] = params[:folder].gsub("//", "/") if params[:folder].present?
case params[:media_action]
when "new_folder"
params[:folder] = slugify_folder(params[:folder])
render partial: "rend... | cwe | CWE-918 | Ruby |
/*
* Copyright (C) 2012,2013 - ARM Ltd
* Author: Marc Zyngier <marc.zyngier@arm.com>
*
* Derived from arch/arm/kvm/guest.c:
* Copyright (C) 2012 - Virtual Open Systems and Columbia University
* Author: Christoffer Dall <c.dall@virtualopensystems.com>
*
* This program is free software; you can redistribute it an... | cwe | CWE-20 | 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-326 | Python |
gopherToHTML(GopherStateData * gopherState, char *inbuf, int len)
{
char *pos = inbuf;
char *lpos = NULL;
char *tline = NULL;
LOCAL_ARRAY(char, line, TEMP_BUF_SIZE);
LOCAL_ARRAY(char, tmpbuf, TEMP_BUF_SIZE);
char *name = NULL;
char *selector = NULL;
char *host = NULL;
char *port = NU... | cwe | CWE-400 | C/C++ |
/*
* Copyright (c) 2004-2021, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of cond... | cwe | CWE-918 | 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-617 | Python |
static ssize_t runtime_enabled_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
if (dev->power.disable_depth && (dev->power.runtime_auto == false))
return sprintf(buf, "disabled & forbidden\n");
if (dev->power.disable_depth)
return sprintf(buf, "disabled\n");
if (dev->power.runtime_au... | cwe | CWE-787 | Unknown |
static int do_replace(struct net *net, const void __user *user,
unsigned int len)
{
int ret, countersize;
struct ebt_table_info *newinfo;
struct ebt_replace tmp;
if (copy_from_user(&tmp, user, sizeof(tmp)) != 0)
return -EFAULT;
if (len != sizeof(tmp) + tmp.entries_size) {
BUGPRINT("Wrong len argument... | cwe | CWE-20 | C/C++ |
import datetime
import hashlib
import itertools
import logging
import os
import time
from collections import defaultdict
from dataclasses import asdict, dataclass, field
from operator import itemgetter
from typing import (
IO,
AbstractSet,
Any,
Callable,
Collection,
Dict,
Iterable,
List,... | cwe | CWE-362 | Python |
commit (message, options, callback) {
message = message.replace(/\"/g, "\\");
if (typeof options === "function") {
callback = options;
options = "";
}
return this.exec("commit -m \"" + message + "\" " + options, callback)
} | cwe | CWE-77 | JavaScript |
MagickExport Image *CloneImage(const Image *image,const size_t columns,
const size_t rows,const MagickBooleanType detach,ExceptionInfo *exception)
{
double
scale;
Image
*clone_image;
size_t
length;
/*
Clone the image.
*/
assert(image != (const Image *) NULL);
assert(image->signature =... | cwe | CWE-617 | C/C++ |
FilePath ExtensionPrefs::GetExtensionPath(const std::string& extension_id) {
const DictionaryValue* dict = GetExtensionPref(extension_id);
std::string path;
if (!dict->GetString(kPrefPath, &path))
return FilePath();
return install_directory_.Append(FilePath::FromWStringHack(UTF8ToWide(path)));
} | cwe | CWE-125 | C/C++ |
mrb_remove_method(mrb_state *mrb, struct RClass *c, mrb_sym mid)
{
mt_tbl *h;
MRB_CLASS_ORIGIN(c);
h = c->mt;
if (h && mt_del(mrb, h, mid)) return;
mrb_name_error(mrb, mid, "method '%n' not defined in %C", mid, c);
} | cwe | CWE-787 | C/C++ |
bool WebGLRenderingContextBase::ValidateHTMLImageElement(
const SecurityOrigin* security_origin,
const char* function_name,
HTMLImageElement* image,
ExceptionState& exception_state) {
if (!image || !image->CachedImage()) {
SynthesizeGLError(GL_INVALID_VALUE, function_name, "no image");
return ... | cwe | CWE-20 | C/C++ |
void HTMLDocument::addItemToMap(HashCountedSet<StringImpl*>& map, const AtomicString& name)
{
if (name.isEmpty())
return;
map.add(name.impl());
if (Frame* f = frame())
f->script()->namedItemAdded(this, name);
} | cwe | CWE-399 | C/C++ |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE(context, node->inputs->size == kInputNum);
TF_LITE_ENSURE(context, node->outputs->size == kOutputNum);
const TfLiteTensor* input = GetInput(context, node, kInputData);
const TfLiteTensor* prev_activation =
GetInput(context, n... | cwe | CWE-125 | C/C++ |
/*
* io_dp.c
*
* Implements the dynamic pointer interface.
*
* Based on GD.pm code by Lincoln Stein for interfacing to libgd.
* Added support for reading as well as support for 'tell' and 'seek'.
*
* As will all I/O modules, most functions are for local use only (called
* via function pointers in the I/O conte... | cwe | CWE-119 | C/C++ |
asmlinkage long sys_oabi_epoll_wait(int epfd,
struct oabi_epoll_event __user *events,
int maxevents, int timeout)
{
struct epoll_event *kbuf;
mm_segment_t fs;
long ret, err, i;
if (maxevents <= 0 || maxevents > (INT_MAX/sizeof(struct epoll_event)))
return -EINVAL;
kbuf = kmalloc(sizeof(*kbuf) * ... | cwe | CWE-264 | Unknown |
const exec = require('async-execute');
/**
* Get remote repo name and owner
* @return {string{}}
*/
module.exports = async function remote() {
const origin = await exec('git remote get-url origin');
const nosuffix = origin.replace(/\.git$/, '');
const [ match ] = nosuffix.match(/[\w-]*\/[\w-]+$/) || [ nosuffix ]... | cwe | CWE-88 | JavaScript |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
OpData* data = reinterpret_cast<OpData*>(node->user_data);
const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1);
const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2);
TfLiteTensor* output = GetOutput(context, node, kOut... | cwe | CWE-787 | C/C++ |
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/ory/fosite/handler/pkce (interfaces: PKCERequestStorage)
// 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"
)
// M... | cwe | CWE-287 | Go |
package com.salesmanager.shop.admin.controller.merchant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.inject.Inject;
import javax.servlet.http.H... | cwe | CWE-639 | Java |
read_children(struct archive_read *a, struct file_info *parent)
{
struct iso9660 *iso9660;
const unsigned char *b, *p;
struct file_info *multi;
size_t step, skip_size;
iso9660 = (struct iso9660 *)(a->format->data);
/* flush any remaining bytes from the last round to ensure
* we're positioned */
if (iso9660->e... | cwe | CWE-125 | Unknown |
/*
* 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-200 | Java |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
auto* data =
reinterpret_cast<TfLiteAudioMicrofrontendParams*>(node->user_data);
TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* input = GetInput(context, node, kInputTen... | cwe | CWE-787 | C/C++ |
package org.platformlambda.automation.util;
import org.platformlambda.automation.models.AsyncContextHolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.... | cwe | CWE-611 | Java |
dtls1_process_out_of_seq_message(SSL *s, struct hm_header_st* msg_hdr, int *ok)
{
int i=-1;
hm_fragment *frag = NULL;
pitem *item = NULL;
unsigned char seq64be[8];
unsigned long frag_len = msg_hdr->frag_len;
if ((msg_hdr->frag_off+frag_len) > msg_hdr->msg_len)
goto err;
/* Try to find item in queue, to preve... | cwe | CWE-399 | Unknown |
/* remove eslint errors to see if there is something really wrong */
/*eslint quotes: [0]*/
/*eslint indent: [0]*/
/*eslint vars-on-top: [0]*/
/*eslint yoda: 0*/
/*eslint curly: 0*/
/*eslint no-implicit-coercion: 0*/
/*eslint newline-after-var: 0*/
/*eslint space-before-function-paren: 0*/
/*eslint block-spacing: 0*/
/... | cwe | CWE-94 | JavaScript |
static ssize_t ucma_process_join(struct ucma_file *file,
struct rdma_ucm_join_mcast *cmd, int out_len)
{
struct rdma_ucm_create_id_resp resp;
struct ucma_context *ctx;
struct ucma_multicast *mc;
struct sockaddr *addr;
int ret;
u8 join_state;
if (out_len < sizeof(resp))
return -ENOSPC;
addr = (struct s... | cwe | CWE-416 | C/C++ |
static bool dccp_new(struct nf_conn *ct, const struct sk_buff *skb,
unsigned int dataoff, unsigned int *timeouts)
{
struct net *net = nf_ct_net(ct);
struct dccp_net *dn;
struct dccp_hdr _dh, *dh;
const char *msg;
u_int8_t state;
dh = skb_header_pointer(skb, dataoff, sizeof(_dh), &dh);
BUG_ON(dh == NU... | cwe | CWE-20 | C/C++ |
/* radare2 - LGPL - Copyright 2018-2022 - pancake, mrmacete, keegan */
#include <r_types.h>
#include <r_util.h>
#include <r_lib.h>
#include <r_bin.h>
#include <r_core.h>
#include <r_io.h>
#include <ht_pu.h>
// #include "../format/mach0/mach0_defines.h"
#define R_BIN_MACH064 1
#include "../format/mach0/mach0.h"
#includ... | cwe | CWE-122 | C/C++ |
find_match_text(colnr_T startcol, int regstart, char_u *match_text)
{
colnr_T col = startcol;
int c1, c2;
int len1, len2;
int match;
for (;;)
{
match = TRUE;
len2 = MB_CHAR2LEN(regstart); // skip regstart
for (len1 = 0; match_text[len1] != NUL; len1 += MB_CHAR2LEN(c1))
{
c1... | cwe | CWE-122 | Unknown |
/**
* 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-22 | Java |
HexOutStream::writeBuffer() {
U8* pos = start;
while (pos != ptr) {
out_stream.check(2);
U8* optr = out_stream.getptr();
U8* oend = out_stream.getend();
int length = min(ptr-pos, (oend-optr)/2);
for (int i=0; i<length; i++) {
optr[i*2] = intToHex((pos[i] >> 4) & 0xf);
optr[i*2+1] = ... | cwe | CWE-122 | C/C++ |
def deleteKey(client):
"""Deletes the specified key.
Returns an error if the key doesn't exist
"""
global BAD_REQUEST
global NOT_FOUND
validateClient(client)
client_pub_key = loadClientRSAKey(client)
token_data = decodeRequestToken(request.data, client_pub_key)
if re.search('[^a-zA-Z0-9]', token_data['key']... | cwe | CWE-22 | Python |
// SPDX-License-Identifier: GPL-2.0-only
/* SocketCAN driver for Microchip CAN BUS Analyzer Tool
*
* Copyright (C) 2017 Mobica Limited
*
* This driver is inspired by the 4.6.2 version of net/can/usb/usb_8dev.c
*/
#include <asm/unaligned.h>
#include <linux/can.h>
#include <linux/can/dev.h>
#include <linux/can/erro... | cwe | CWE-415 | C/C++ |
static int nf_conntrack_standalone_init_sysctl(struct net *net)
{
struct nf_conntrack_net *cnet = net_generic(net, nf_conntrack_net_id);
struct nf_udp_net *un = nf_udp_pernet(net);
struct ctl_table *table;
BUILD_BUG_ON(ARRAY_SIZE(nf_ct_sysctl_table) != NF_SYSCTL_CT_LAST_SYSCTL);
table = kmemdup(nf_ct_sysctl_tabl... | cwe | CWE-203 | C/C++ |
QPDF::readObject(PointerHolder<InputSource> input,
std::string const& description,
int objid, int generation, bool in_object_stream)
{
setLastObjectDescription(description, objid, generation);
qpdf_offset_t offset = input->tell();
bool empty = false;
PointerHolder<StringDecrypter> decrypter_ph;
... | cwe | CWE-787 | Unknown |
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.... | cwe | CWE-611 | Java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.