code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
import { mainPage } from "../../support/page_objects/mainPage";
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} api - M2M Column validation`, () =>... | cwe | CWE-400 | JavaScript |
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2007-2009 Patrick McHardy <kaber@trash.net>
*
* Development of this code funded by Astaro AG (http://www.astaro.com/)
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/skbuff.h>
#include <linux/netlink.h>
#includ... | cwe | CWE-400 | C/C++ |
PHP_FUNCTION(finfo_open)
{
long options = MAGIC_NONE;
char *file = NULL;
int file_len = 0;
struct php_fileinfo *finfo;
FILEINFO_DECLARE_INIT_OBJECT(object)
char resolved_path[MAXPATHLEN];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lp", &options, &file, &file_len) == FAILURE) {
FILEINFO_DESTROY_OBJ... | cwe | CWE-254 | C/C++ |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
if (input->type != kTfLiteFloat32) {
TF_LITE_UNSUPPORTED_TYPE(context, input->type, "Ceil");
}
optimized_ops::Ce... | cwe | CWE-125 | C/C++ |
juniper_mlppp_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, register const u_char *p)
{
struct juniper_l2info_t l2info;
l2info.pictype = DLT_JUNIPER_MLPPP;
if (juniper_parse_header(ndo, p, h, &l2info) == 0)
return l2info.header_len;
/* supp... | cwe | CWE-125 | C/C++ |
package com.salesmanager.shop.application.config;
import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM;
import static org.springframework.http.MediaType.IMAGE_GIF;
import static org.springframework.http.MediaType.IMAGE_JPEG;
import static org.springframework.http.MediaType.IMAGE_PNG;
import java.... | cwe | CWE-79 | Java |
public function save()
{
$project = $this->getProject();
$values = $this->request->getValues();
list($valid, $errors) = $this->categoryValidator->validateCreation($values);
if ($valid) {
if ($this->categoryModel->create($values) !== false) {
$this->flash... | cwe | CWE-639 | PHP |
void CreateAuthenticatorFactory() {
DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
std::string local_certificate = key_pair_.GenerateCertificate();
if (local_certificate.empty()) {
LOG(ERROR) << "Failed to generate host certificate.";
Shutdown(kHostInitializationFailed)... | cwe | CWE-119 | C/C++ |
static void __munlock_pagevec(struct pagevec *pvec, struct zone *zone)
{
int i;
int nr = pagevec_count(pvec);
int delta_munlocked;
struct pagevec pvec_putback;
int pgrescued = 0;
pagevec_init(&pvec_putback, 0);
/* Phase 1: page isolation */
spin_lock_irq(zone_lru_lock(zone));
for (i = 0; i < nr; i++) {
str... | cwe | CWE-20 | Unknown |
static inline void vma_adjust_trans_huge(struct vm_area_struct *vma,
unsigned long start,
unsigned long end,
long adjust_next)
{
if (!vma->anon_vma || vma->vm_ops || vma->vm_file)
return;
__vma_adjust_trans_huge(vma, start, end, adjust_next);
} | cwe | CWE-399 | C/C++ |
("/"==R.charAt(0)?"":u)+R);E.push('url("'+R+'"'+J[Q].substring(T))}else E.push(J[Q])}else E=[u]}return null!=E?E.join(""):null};Editor.prototype.mapFontUrl=function(u,E,J){/^https?:\/\//.test(E)&&!this.isCorsEnabledForUrl(E)&&(E=PROXY_URL+"?url="+encodeURIComponent(E));J(u,E)};Editor.prototype.embedCssFonts=function(u,... | cwe | CWE-20 | JavaScript |
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2021 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either ... | cwe | CWE-306 | Go |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-190 | C/C++ |
} elseif ($part != '.') {
$depath++;
} | cwe | CWE-22 | PHP |
tt_cmap4_validate( FT_Byte* table,
FT_Validator valid )
{
FT_Byte* p;
FT_UInt length;
FT_Byte *ends, *starts, *offsets, *deltas, *glyph_ids;
FT_UInt num_segs;
FT_Error error = FT_Err_Ok;
if ( table + 2 + 2 > valid->limit )
FT_INVALID_TOO_SHORT;
... | cwe | CWE-119 | C/C++ |
function TagViewModel(data) {
this.Id = data.ID;
this.Name = data.Name;
} | cwe | CWE-79 | JavaScript |
/**
* New node file
*/
debug=true;
function Adult(databaseObject)
{
this.databaseObject=databaseObject;
this.scouts=[];
}
function hashPassword(password)
{
var hash=0;
for (i=0;i<password.length;i++)
{
hash+=password[i].charCodeAt()*37;
}
return hash;
}
function selectAdult(username, connection)
{
var s... | cwe | CWE-89 | JavaScript |
fmgr_internal_validator(PG_FUNCTION_ARGS)
{
Oid funcoid = PG_GETARG_OID(0);
HeapTuple tuple;
bool isnull;
Datum tmp;
char *prosrc;
/*
* We do not honor check_function_bodies since it's unlikely the function
* name will be found later if it isn't there now.
*/
tuple = SearchSysCache1(PROCOID, Objec... | cwe | CWE-264 | Unknown |
/************************************************************************
* 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 |
extern "C" int64_t enc_untrusted_syscall(int sysno, ...) {
if (!enc_is_error_handler_set()) {
enc_set_error_handler(default_error_handler);
}
asylo::system_call::SystemCallDescriptor descriptor{sysno};
if (!descriptor.is_valid()) {
error_handler("system_call.cc: Invalid SystemCallDescriptor encountered... | cwe | CWE-125 | C/C++ |
static int snd_compr_allocate_buffer(struct snd_compr_stream *stream,
struct snd_compr_params *params)
{
unsigned int buffer_size;
void *buffer;
buffer_size = params->buffer.fragment_size * params->buffer.fragments;
if (stream->ops->copy) {
buffer = NULL;
/* if copy is defined the driver will be requir... | cwe | CWE-703 | C/C++ |
processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
int id)
{
int dnsseclame = 0;
enum response_type type;
iq->num_current_queries--;
if(!inplace_cb_query_response_call(qstate->env, qstate, iq->response))
log_err("unable to call query_response callback");
if(iq->response == NULL) {
/*... | cwe | CWE-400 | Unknown |
match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
const unsigned char *s, size_t nbytes, size_t offset, int mode, int text,
int flip, int *returnval)
{
uint32_t magindex = 0;
unsigned int cont_level = 0;
int need_separator = 0;
int returnvalv = 0, e; /* if a match is found it is set to 1*/
... | cwe | CWE-755 | Unknown |
package conmonmgr
import (
"path"
"strings"
"github.com/blang/semver"
"github.com/cri-o/cri-o/utils/cmdrunner"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
var versionSupportsSync = semver.MustParse("2.0.19")
type ConmonManager struct {
conmonVersion *semver.Version
supportsSync bool
}
// this f... | cwe | CWE-400 | Go |
bool Permissions::check_create_datareader(
const PermissionsHandle& local_handle,
const uint32_t /*domain_id*/,
const std::string& topic_name,
const std::vector<std::string>& partitions,
SecurityException& exception)
{
bool returned_value = false;
const AccessPermissionsH... | cwe | CWE-284 | Unknown |
define([
'./summary-widget.html',
'@braintree/sanitize-url'
], function (
summaryWidgetTemplate,
urlSanitizeLib
) {
const WIDGET_ICON_CLASS = 'c-sw__icon js-sw__icon';
function SummaryWidgetView(domainObject, openmct) {
this.openmct = openmct;
this.domainObject = domainObject;
... | cwe | CWE-79 | JavaScript |
/*
* Copyright (c) 2010 Aurelien Jacobs <aurel@gnuage.org>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (a... | cwe | CWE-125 | C/C++ |
/* JSON_parser.c */
/* 2005-12-30 */
/*
Copyright (c) 2005 JSON.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, mod... | cwe | CWE-125 | C/C++ |
function renderSimpleTemplateWithValidators(formElement, template) {
var validators, validatorsCountWithoutRequired, validatorsTemplateContent;
assert('object' === $.type(formElement), 'Invalid parameter "formElement"', 1479035674);
renderSimpleTemplate(formElement, template);
validatorsTempla... | cwe | CWE-79 | JavaScript |
static void tm_reclaim_thread(struct thread_struct *thr,
struct thread_info *ti, uint8_t cause)
{
unsigned long msr_diff = 0;
/*
* If FP/VSX registers have been already saved to the
* thread_struct, move them to the transact_fp array.
* We clear the TIF_RESTORE_TM bit since after the reclaim
* the t... | cwe | CWE-284 | C/C++ |
"""Tornado handlers for frontend config storage."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import json
import os
import io
import errno
from tornado import web
from IPython.utils.py3compat import PY3
from ...base.handlers import IPythonHandler, json_errors... | cwe | CWE-79 | Python |
package profile
import (
"bufio"
"bytes"
"context"
"crypto"
"crypto/hmac"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"crypto/sha512"
"crypto/subtle"
"crypto/tls"
"crypto/x509"
"encoding/base64"
"encoding/json"
"encoding/pem"
"fmt"
"io"
"io/ioutil"
mathrand "math/rand"
"net"
"net/http"
"net/url"
... | cwe | CWE-269 | Go |
uint NotificationsEngine::Notify(const QString &app_name, uint replaces_id,
const QString &app_icon, const QString &summary, const QString &body,
const QStringList &actions, const QVariantMap &hints, int timeout)
{
uint partOf = 0;
const QString ... | cwe | CWE-200 | C/C++ |
package io.swagger.client.api;
import io.swagger.client.ApiException;
import io.swagger.client.ApiClient;
import io.swagger.client.ApiResponse;
import io.swagger.client.Configuration;
import io.swagger.client.Pair;
import javax.ws.rs.core.GenericType;
import io.swagger.client.model.Client;
import java.util.ArrayLis... | cwe | CWE-200 | Java |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* 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 applic... | cwe | CWE-770 | C/C++ |
_XimProtoGetIMValues(
XIM xim,
XIMArg *arg)
{
Xim im = (Xim)xim;
register XIMArg *p;
register int n;
CARD8 *buf;
CARD16 *buf_s;
INT16 len;
CARD32 reply32[BUFSIZE/4];
char *reply = (char *)reply32;
XPointer preply = NULL;
int buf_size;
int ret_co... | cwe | CWE-190 | Unknown |
BnGeneratePrimeForRSA(
bigNum prime, // IN/OUT: points to the BN that will get the
// random value
UINT32 bits, // IN: number of bits to get
UINT32 exponent, // IN: the exponent
RAND_STATE *rand // IN: the random... | cwe | CWE-331 | Unknown |
/*
* MinIO Cloud Storage, (C) 2016-2019 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicab... | cwe | CWE-918 | Go |
public void checkServerTrusted(X509Certificate[] chain, String authType)
throws CertificateException
{
Collection<? extends Certificate> certs = null;
X509Certificate cert = chain[0];
try {
cert.checkValidity();
} catch(CertificateNotYetValidException e) {
throw new Aut... | cwe | CWE-295 | Java |
ProcXkbSetMap(ClientPtr client)
{
DeviceIntPtr dev;
char *tmp;
int rc;
REQUEST(xkbSetMapReq);
REQUEST_AT_LEAST_SIZE(xkbSetMapReq);
if (!(client->xkbClientFlags & _XkbClientInitialized))
return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixManageAccess);
CHK_MASK... | cwe | CWE-119 | C/C++ |
int length() const {
return m_str ? m_str->size() : 0;
} | cwe | CWE-122 | C/C++ |
static int netlbl_cipsov4_add_common(struct genl_info *info,
struct cipso_v4_doi *doi_def)
{
struct nlattr *nla;
int nla_rem;
u32 iter = 0;
doi_def->doi = nla_get_u32(info->attrs[NLBL_CIPSOV4_A_DOI]);
if (nla_validate_nested(info->attrs[NLBL_CIPSOV4_A_TAGLST],
NLBL_CIPSOV4_A_MAX,
netlbl_cipsov4_... | cwe | CWE-119 | C/C++ |
import codecs
import errno
import gzip
import os
import posixpath
import shutil
import sys
import tarfile
import tempfile
import stat
import urllib.parse
import urllib.request
from urllib.parse import unquote
from urllib.request import pathname2url
import yaml
try:
from yaml import CSafeLoader as YamlSafeLoader,... | cwe | CWE-668 | Python |
package com.salesmanager.shop.admin.controller.products;
import com.salesmanager.core.business.services.catalog.product.attribute.ProductOptionValueService;
import com.salesmanager.core.business.services.content.ContentService;
import com.salesmanager.core.business.services.reference.language.LanguageService;
import c... | cwe | CWE-639 | Java |
static int start_decoder(vorb *f)
{
uint8 header[6], x,y;
int len,i,j,k, max_submaps = 0;
int longest_floorlist=0;
if (!start_page(f)) return FALSE;
if (!(f->page_flag & PAGEFLAG_first_page)) return error(f, VORBIS_invalid_first_page);
if (f->page_flag & PAGEFLAG_l... | cwe | CWE-20 | Unknown |
evbuffer_ptr_subtract(struct evbuffer *buf, struct evbuffer_ptr *pos,
size_t howfar)
{
if (howfar > (size_t)pos->pos)
return -1;
if (pos->internal_.chain && howfar <= pos->internal_.pos_in_chain) {
pos->internal_.pos_in_chain -= howfar;
pos->pos -= howfar;
return 0;
} else {
const size_t newpos = pos->... | cwe | CWE-189 | Unknown |
void luaReplyToRedisReply(client *c, lua_State *lua) {
int t = lua_type(lua,-1);
switch(t) {
case LUA_TSTRING:
addReplyBulkCBuffer(c,(char*)lua_tostring(lua,-1),lua_strlen(lua,-1));
break;
case LUA_TBOOLEAN:
if (server.lua_client->resp == 2)
addReply(c,lua_toboolean(... | cwe | CWE-787 | 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 |
# Copyright (c) 2016 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of G... | cwe | CWE-264 | Python |
bool RenderFrameDevToolsAgentHost::AttachSession(DevToolsSession* session) {
if (!ShouldAllowSession(session))
return false;
protocol::EmulationHandler* emulation_handler =
new protocol::EmulationHandler();
session->AddHandler(base::WrapUnique(new protocol::BrowserHandler()));
session->AddHandler(... | cwe | CWE-269 | C/C++ |
struct r_bin_pe_addr_t *PE_(check_unknow)(RBinPEObj *pe) {
struct r_bin_pe_addr_t *entry;
if (!pe || !pe->b) {
return 0LL;
}
ut8 b[512];
ZERO_FILL (b);
entry = PE_ (r_bin_pe_get_entrypoint) (pe);
// option2: /x 8bff558bec83ec20
if (r_buf_read_at (pe->b, entry->paddr, b, 512) < 1) {
pe_printf ("Warning: Cann... | cwe | CWE-400 | C/C++ |
srtp_protect(srtp_ctx_t *ctx, void *rtp_hdr, int *pkt_octet_len) {
srtp_hdr_t *hdr = (srtp_hdr_t *)rtp_hdr;
uint32_t *enc_start; /* pointer to start of encrypted portion */
uint32_t *auth_start; /* pointer to start of auth. portion */
int enc_octet_len = 0; /* number of octets in encrypte... | cwe | CWE-119 | Unknown |
bool Virtual_column_info::fix_session_expr(THD *thd)
{
DBUG_ENTER("fix_session_vcol_expr");
if (!(flags & (VCOL_TIME_FUNC|VCOL_SESSION_FUNC)))
DBUG_RETURN(0);
expr->walk(&Item::cleanup_excluding_fields_processor, 0, 0);
DBUG_ASSERT(!expr->fixed);
DBUG_RETURN(fix_expr(thd));
} | cwe | CWE-416 | Unknown |
Pl_Count::write(unsigned char* buf, size_t len)
{
if (len)
{
this->m->count += QIntC::to_offset(len);
getNext()->write(buf, len);
this->m->last_char = buf[len - 1];
}
} | cwe | CWE-787 | C/C++ |
/*
BNEP implementation for Linux Bluetooth stack (BlueZ).
Copyright (C) 2001-2002 Inventel Systemes
Written 2001-2002 by
Clément Moreau <clement.moreau@inventel.fr>
David Libault <david.libault@inventel.fr>
Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
This program is free software; you c... | cwe | CWE-264 | C/C++ |
def private_messages_for(user, type)
options = @options
options.reverse_merge!(per_page: per_page_setting)
result = Topic.includes(:allowed_users)
result = result.includes(:tags) if SiteSetting.tagging_enabled
if type == :group
result = result.joins(
"INNER JOIN topic_a... | cwe | CWE-200 | Ruby |
// Copyright 2009,2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// NetBSD system calls.
// This file is compiled as ordinary Go code,
// but it is also input to mksyscall,
// which parses the //sys lines and generates s... | cwe | CWE-287 | Go |
static int update_table(struct libmnt_update *upd, struct libmnt_table *tb)
{
FILE *f;
int rc, fd;
char *uq = NULL;
if (!tb || !upd->filename)
return -EINVAL;
DBG(UPDATE, mnt_debug_h(upd, "%s: updating", upd->filename));
fd = mnt_open_uniq_filename(upd->filename, &uq);
if (fd < 0)
return fd; /* error */
... | cwe | CWE-399 | Unknown |
# -*- coding: utf-8 -*-
# This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
# Copyright (C) 2018-2019 OzzieIsaacs, cervinko, jkrehm, bodybybuddha, ok11,
# andy29485, idalin, Kyosfonica, wuqi, Kennyl, lemmsh,
# falgh1, grunjol, csitk... | cwe | CWE-352 | JavaScript |
// 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-787 | C/C++ |
def timeline
unless params[:type].empty?
model = params[:type].camelize.constantize
item = model.find(params[:id])
item.update_attribute(:state, params[:state])
else
comments, emails = params[:id].split("+")
Comment.update_all("state = '#{params[:state]}'", "id IN (#{comments})") u... | cwe | CWE-89 | Ruby |
'use strict';
const path = require('path');
const { promisify } = require('util');
const tmpDir = promisify(require('tmp').dir);
const fs = require('fs-extra');
const uuidv1 = require('uuid/v1');
const debug = require('debug')('git-diff-apply');
const utils = require('./utils');
const getRootDir = require('./get-root-... | cwe | CWE-78 | JavaScript |
unsigned char *cipso_v4_optptr(const struct sk_buff *skb)
{
const struct iphdr *iph = ip_hdr(skb);
unsigned char *optptr = (unsigned char *)&(ip_hdr(skb)[1]);
int optlen;
int taglen;
for (optlen = iph->ihl*4 - sizeof(struct iphdr); optlen > 0; ) {
if (optptr[0] == IPOPT_CIPSO)
return optptr;
taglen = optpt... | cwe | CWE-835 | Unknown |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "hermes/VM/Operations.h"
#include "hermes/Support/Conversions.h"
#include "hermes/Support/OSCompat.h"
#include "hermes/... | cwe | CWE-681 | C/C++ |
int string_rfind(const char *input, int len, const char *s, int s_len,
int pos, bool case_sensitive) {
assertx(input);
assertx(s);
if (!s_len || pos < -len || pos > len) {
return -1;
}
void *ptr;
if (case_sensitive) {
if (pos >= 0) {
ptr = bstrrstr(input + pos, len - pos, s, s... | cwe | CWE-125 | C/C++ |
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-369 | Python |
/*!
* VisualEditor user interface MWMediaDialog class.
*
* @copyright 2011-2020 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* Dialog for inserting and editing MediaWiki media.
*
* @class
* @extends ve.ui.NodeDialog
*
* @constructor
* @param {Object... | cwe | CWE-79 | JavaScript |
"""
Base classes for Custom Authenticator to use OAuth with JupyterHub
Most of the code c/o Kyle Kelley (@rgbkrk)
"""
import base64
import json
import os
import uuid
from urllib.parse import quote, urlparse, urlunparse
from jupyterhub.auth import Authenticator
from jupyterhub.handlers import BaseHandler, LogoutHandle... | cwe | CWE-639 | Python |
def addKey(client):
"""Adds a new key with the specified name and contents.
Returns an error if a key with the specified name already exists.
"""
global BAD_REQUEST
global CREATED
validateClient(client)
client_pub_key = loadClientRSAKey(client)
token_data = decodeRequestToken(request.data, client_pub_key)
va... | cwe | CWE-22 | Python |
def get_cluster_tokens(params, request, session)
# pcsd runs as root thus always returns hacluster's tokens
if not allowed_for_local_cluster(session, Permissions::FULL)
return 403, "Permission denied"
end
on, off = get_nodes
nodes = on + off
nodes.uniq!
return [200, JSON.generate(get_tokens_of_nodes(n... | cwe | CWE-384 | Ruby |
function __processMessage$1(modules, message) {
var config = modules.config, crypto = modules.crypto;
if (!config.cipherKey)
return message;
try {
return crypto.decrypt(message);
}
catch (e) {
return message;
}
} | cwe | CWE-331 | JavaScript |
static opj_bool pi_next_cprl(opj_pi_iterator_t * pi)
{
opj_pi_comp_t *comp = NULL;
opj_pi_resolution_t *res = NULL;
long index = 0;
if (!pi->first) {
comp = &pi->comps[pi->compno];
goto LABEL_SKIP;
} else {
pi->first = 0;
}
for (pi->compno = pi->poc.compno0; pi->com... | cwe | CWE-20 | C/C++ |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
// TODO(b/143912164): instead of hardcode the epsilon here, we should read it
// from tensorflow, i.e., adding a param... | cwe | CWE-787 | C/C++ |
static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data,
unsigned int len)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct ieee80211_mgmt *mgmt = data;
struct rtl_p2p_ps_info *p2pinfo = &(rtlpriv->psc.p2p_ps_info);
u8 *pos, *end, *ie;
u16 noa_len;
static u8 p2p_oui_ie_type[4] = {0x50, 0x6f, 0x9a, 0... | cwe | CWE-120 | C/C++ |
@SuppressWarnings("unchecked")
public void reloadConfig(boolean init, boolean reset) {
Path curConfig = Paths.get("config.yaml");
if (init) {
if (reset) {
InputStream is = this.getClass().getClassLoader().getResourceAsStream("config.yaml");
configStr = IOU... | cwe | CWE-502 | Java |
function storeSerializedSession($serialized_session_data, $session_id)
{
$doSession = OA_Dal::staticGetDO('session', $session_id);
if ($doSession) {
$doSession->sessiondata = $serialized_session_data;
$doSession->update();
}
else {
$doSession = OA_... | cwe | CWE-384 | PHP |
func GetHostsFromGroup(grpName string) map[string]int {
hosts := make(map[string]int)
now := time.Now().Unix()
q := fmt.Sprintf("SELECT host.id, host.hostname FROM grp_host AS gh "+
" INNER JOIN host ON host.id=gh.host_id AND (host.maintain_begin > %d OR host.maintain_end < %d)"+
" INNER JOIN grp ON grp.id=gh.g... | cwe | CWE-89 | Go |
new Menu(mxUtils.bind(this,function(M,W){for(var U=0;U<S.length;U++)"-"==S[U]?M.addSeparator(W):V(M,W,mxResources.get(S[U])+"...",S[U])})))};EditorUi.prototype.installFormatToolbar=function(C){var D=this.editor.graph,G=document.createElement("div");G.style.cssText="position:absolute;top:10px;z-index:1;border-radius:4px... | cwe | CWE-20 | JavaScript |
#include <qpdf/Pl_ASCIIHexDecoder.hh>
#include <qpdf/QTC.hh>
#include <stdexcept>
#include <string.h>
#include <ctype.h>
Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) :
Pipeline(identifier, next),
pos(0),
eod(false)
{
this->inbuf[0] = '0';
this->inbuf[1] = '0';
... | cwe | CWE-787 | C/C++ |
# coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: https://sickrage.github.io
#
# This file is part of SickRage.
#
# SickRage 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 Li... | cwe | CWE-255 | Python |
function ecrecover(recId, sigr, sigs, message) {
// 1.0 For j from 0 to h (h == recId here and the loop is outside this function)
// 1.1 Let x = r + jn
const x = addmod(uint256(sigr), P.muln(recId >> 1), P)
// 1.2. Convert the integer x to an octet string X of length mlen using the... | cwe | CWE-347 | JavaScript |
formUpdateBuffer(Anchor *a, Buffer *buf, FormItemList *form)
{
Buffer save;
char *p;
int spos, epos, rows, c_rows, pos, col = 0;
Line *l;
copyBuffer(&save, buf);
gotoLine(buf, a->start.line);
switch (form->type) {
case FORM_TEXTAREA:
case FORM_INPUT_TEXT:
case FORM_INPUT_FILE:
... | cwe | CWE-476 | C/C++ |
function finishView (view) {
// todo list
const lis = view.find('li.raw').removeClass('raw').sortByDepth().toArray()
for (let li of lis) {
let html = $(li).clone()[0].innerHTML
const p = $(li).children('p')
if (p.length === 1) {
html = p.html()
li = p[0]
}
html = replaceExtraTags(... | cwe | CWE-79 | JavaScript |
(function()
{
Sidebar.prototype.addSysMLPalette = function()
{
this.setCurrentSearchEntryLibrary('sysml', 'sysmlModel Elements');
this.addSysMLModelElementsPalette();
this.setCurrentSearchEntryLibrary('sysml', 'sysmlBlocks');
this.addSysMLBlocksPalette();
this.setCurrentSearchEntryLibrary('sysml', 'sysmlPor... | cwe | CWE-284 | Java |
static Image *ReadICONImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
IconFile
icon_file;
IconInfo
icon_info;
Image
*image;
MagickBooleanType
status;
MagickSizeType
extent;
register ssize_t
i,
x;
register Quantum
*q;
register unsigned char
*p;
... | cwe | CWE-772 | C/C++ |
// Copyright 2019 The Nakama 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 ... | cwe | CWE-307 | Go |
if rf, ok := ret.Get(0).(func(string, kube.ResourceKey, func(v1alpha1.ResourceNode, string)) error); ok {
r0 = rf(server, key, action)
} else {
r0 = ret.Error(0)
}
return r0
} | cwe | CWE-862 | Go |
public boolean checkUrlParameter(String url)
{
if (url != null)
{
try
{
URL parsedUrl = new URL(url);
String protocol = parsedUrl.getProtocol();
String host = parsedUrl.getHost().toLowerCase();
return (protocol.equals("http") || protocol.equals("https"))
&& !host.endsWith(".internal")
... | cwe | CWE-918 | Java |
$arcs['create']['application/x-rar'] = array('cmd' => ELFINDER_RAR_PATH, 'argc' => 'a -inul' . (defined('ELFINDER_RAR_MA4') && ELFINDER_RAR_MA4? ' -ma4' : ''), 'ext' => 'rar'); | cwe | CWE-22 | PHP |
import namedavatar from 'namedavatar'
import { QuillDeltaToHtmlConverter } from 'quill-delta-to-html'
import './projectchart.html'
import Projects, { ProjectStats } from '../../api/projects/projects.js'
import projectUsers from '../../api/users/users.js'
import { getUserSetting, getUserTimeUnitVerbose } from '../../uti... | cwe | CWE-1236 | JavaScript |
function J(){var t=(new Date).getTime();if(!r)r=50;X();a();v();D();q(r);var e=(new Date).getTime()-t} | cwe | CWE-1333 | JavaScript |
bool Capability::ChangeUnixUser(uid_t uid) {
if (setInitialCapabilities()) {
struct passwd *pw;
if ((pw = getpwuid(uid)) == nullptr) {
Logger::Error("unable to getpwuid(%d): %s", uid,
folly::errnoStr(errno).c_str());
return false;
}
if (pw->pw_gid == 0 || setgid(pw->p... | cwe | CWE-264 | C/C++ |
import os
import os.path
import shutil
from babel.messages.frontend import CommandLineInterface
from translate.convert.po2csv import main as po2csv
from translate.convert.csv2po import main as csv2po
ROOT_DIR = 'i18n'
TRANSLATIONS = os.path.join(ROOT_DIR, 'translations')
MESSAGES = os.path.join(ROOT_DIR, 'message... | cwe | CWE-79 | Python |
func (m *wrappedMAC) ComputeMAC(data []byte) ([]byte, error) {
primary := m.ps.Primary
primitive, ok := (primary.Primitive).(tink.MAC)
if !ok {
return nil, fmt.Errorf("mac_factory: not a MAC primitive")
}
if m.ps.Primary.PrefixType == tinkpb.OutputPrefixType_LEGACY {
d := data
if len(d) == maxInt {
return... | cwe | CWE-681 | Go |
long Segment::ParseNext(
const Cluster* pCurr,
const Cluster*& pResult,
long long& pos,
long& len)
{
assert(pCurr);
assert(!pCurr->EOS());
assert(m_clusters);
pResult = 0;
if (pCurr->m_index >= 0) //loaded (not merely preloaded)
{
assert(m_clusters[pCurr->m_index] ==... | cwe | CWE-119 | C/C++ |
DataBuf PngChunk::parseTXTChunk(const DataBuf& data,
int keysize,
TxtChunkType type)
{
DataBuf arr;
if(type == zTXt_Chunk)
{
// Extract a deflate compressed Latin-1 text chunk
// we... | cwe | CWE-125 | C/C++ |
const {
setActions,
// queue: jobQueue,
// reportError,
_unstable_createJob,
_lazyJobsEnabled,
} = require(`./index`)
const { pathExists } = require(`fs-extra`)
const { slash } = require(`gatsby-core-utils/path`)
const { setPluginOptions } = require(`./plugin-options`)
const path = require(`path`)
function ... | cwe | CWE-22 | JavaScript |
/* exif-mnote-data-pentax.c
*
* Copyright (c) 2002, 2003 Lutz Mueller <lutz@users.sourceforge.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the Licen... | cwe | CWE-416 | C/C++ |
on_register_handler(TCMUService1HandlerManager1 *interface,
GDBusMethodInvocation *invocation,
gchar *subtype,
gchar *cfg_desc,
gpointer user_data)
{
struct tcmur_handler *handler;
struct dbus_info *info;
char *bus_name;
bus_name = g_strdup_printf("org.kernel.TCMUService1.HandlerManager1.%s... | cwe | CWE-476 | Unknown |
static void vnc_zrle_start(VncState *vs)
{
buffer_reset(&vs->zrle.zrle);
/* make the output buffer be the zlib buffer, so we can compress it later */
vs->zrle.tmp = vs->output;
vs->output = vs->zrle.zrle;
} | cwe | CWE-401 | Unknown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.