code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
rdpdr_process(STREAM s)
{
uint32 handle;
uint16 vmin;
uint16 component;
uint16 pakid;
#if WITH_DEBUG_RDP5
printf("--- rdpdr_process ---\n");
hexdump(s->p, s->end - s->p);
#endif
in_uint16(s, component);
in_uint16(s, pakid);
if (component == RDPDR_CTYP_CORE)
{
switch (pakid)
{
case PAKID_CORE_DEVICE_... | cwe | CWE-787 | Unknown |
int Socket::startSslClient(const std::string &certificate_path, String hostname)
{
if (isssl) {
stopSsl();
}
ERR_clear_error();
#if OPENSSL_VERSION_NUMBER < 0x10100000L
ctx = SSL_CTX_new(SSLv23_client_method());
#else
ctx = SSL_CTX_new(TLS_client_method());
#endif
if (ctx == NULL) {
#i... | cwe | CWE-295 | C/C++ |
static int nfs_can_extend_write(struct file *file, struct page *page, struct inode *inode)
{
if (file->f_flags & O_DSYNC)
return 0;
if (NFS_PROTO(inode)->have_delegation(inode, FMODE_WRITE))
return 1;
if (nfs_write_pageuptodate(page, inode) && (inode->i_flock == NULL ||
(inode->i_flock->fl_start == 0 &&
... | cwe | CWE-20 | C/C++ |
#include <uwsgi.h>
extern struct uwsgi_server uwsgi;
#ifdef __BIG_ENDIAN__
uint16_t uwsgi_swap16(uint16_t x) {
return (uint16_t) ((x & 0xff) << 8 | (x & 0xff00) >> 8);
}
uint32_t uwsgi_swap32(uint32_t x) {
x = ((x << 8) & 0xFF00FF00) | ((x >> 8) & 0x00FF00FF);
return (x >> 16) | (x << 16);
}
// thanks to ffmpeg... | cwe | CWE-119 | Python |
def handle_request(client, lines, requests)
env = client.env
io = client.io # io may be a MiniSSL::Socket
return false if closed_socket?(io)
normalize_env env, client
env[PUMA_SOCKET] = io
if env[HTTPS_KEY] && io.peercert
env[PUMA_PEERCERT] = io.peercert
end
... | cwe | CWE-404 | Ruby |
obj2ast_type_ignore(PyObject* obj, type_ignore_ty* out, PyArena* arena)
{
int isinstance;
PyObject *tmp = NULL;
if (obj == Py_None) {
*out = NULL;
return 0;
}
isinstance = PyObject_IsInstance(obj, (PyObject*)TypeIgnore_type);
if (isinstance == -1) {
return 1;
}
... | cwe | CWE-125 | C/C++ |
UrlQuery::UrlQuery(const std::string& encoded_str) {
if (!encoded_str.empty()) {
// Split into key value pairs separated by '&'.
for (std::size_t i = 0; i != std::string::npos;) {
std::size_t j = encoded_str.find_first_of('&', i);
std::string kv;
if (j == std::string::npos) {
kv = e... | cwe | CWE-22 | Unknown |
public DSpaceObject getParentObject(Context context, Group group) throws SQLException {
if (group == null) {
return null;
}
// could a collection/community administrator manage related groups?
// check before the configuration options could give a performance gain
// ... | cwe | CWE-863 | Java |
void fslib_copy_libs(const char *full_path) {
assert(full_path);
if (arg_debug || arg_debug_private_lib)
printf(" fslib_copy_libs %s\n", full_path);
// if library/executable does not exist or the user does not have read access to it
// print a warning and exit the function.
if (access(full_path, R_OK)) {
i... | cwe | CWE-284 | Unknown |
private function _categoriesminmax( $option ) {
if ( is_numeric( $option[0] ) ) {
$this->addWhere( intval( $option[0] ) . ' <= (SELECT count(*) FROM ' . $this->tableNames['categorylinks'] . ' WHERE ' . $this->tableNames['categorylinks'] . '.cl_from=page_id)' );
}
if ( is_numeric( $option[1] ) ) {
$this->add... | cwe | CWE-400 | PHP |
catch_exception_raise(mach_port_t exception_port GC_ATTR_UNUSED,
mach_port_t thread, mach_port_t task GC_ATTR_UNUSED,
exception_type_t exception, exception_data_t code,
mach_msg_type_number_t code_count GC_ATTR_UNUSED)
{
kern_return_t r;
char *addr;
... | cwe | CWE-119 | Unknown |
vhost_backend_cleanup(struct virtio_net *dev)
{
if (dev->mem) {
free_mem_region(dev);
rte_free(dev->mem);
dev->mem = NULL;
}
rte_free(dev->guest_pages);
dev->guest_pages = NULL;
if (dev->log_addr) {
munmap((void *)(uintptr_t)dev->log_addr, dev->log_size);
dev->log_addr = 0;
}
if (dev->inflight_info)... | cwe | CWE-190 | Unknown |
package io.onedev.server.model.support;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.RandomStringUtils;
import io.onedev.server.event.project.RefUpdated;
import ... | cwe | CWE-338 | Java |
int n_ssl3_mac(SSL *ssl, unsigned char *md, int send)
{
SSL3_RECORD *rec;
unsigned char *mac_sec,*seq;
EVP_MD_CTX md_ctx;
const EVP_MD_CTX *hash;
unsigned char *p,rec_char;
unsigned int md_size;
int npad;
int t;
if (send)
{
rec= &(ssl->s3->wrec);
mac_sec= &(ssl->s3->write_mac_secret[0]);
seq= &(ssl->... | cwe | CWE-310 | Unknown |
int __kvm_set_memory_region(struct kvm *kvm,
struct kvm_userspace_memory_region *mem,
int user_alloc)
{
int r;
gfn_t base_gfn;
unsigned long npages;
struct kvm_memory_slot *memslot, *slot;
struct kvm_memory_slot old, new;
struct kvm_memslots *slots, *old_memslots;
r = check_memory_region_flags(mem... | cwe | CWE-399 | C/C++ |
from typing import Dict, Optional, Tuple
from django.utils.translation import ugettext as _
from django.conf import settings
from django.core.files import File
from django.http import HttpRequest
from django.db.models import Sum
from jinja2 import Markup as mark_safe
import unicodedata
from zerver.lib.avatar_hash imp... | cwe | CWE-79 | Python |
bool ms_deliver_verify_authorizer(Connection *con, int peer_type,
int protocol, bufferlist& authorizer, bufferlist& authorizer_reply,
bool& isvalid, CryptoKey& session_key) {
for (list<Dispatcher*>::iterator p = dispatchers.begin();
p != dispatchers.end();
++p) {
if ((*p)->ms_verify_author... | cwe | CWE-287 | Unknown |
isis_print_id(const uint8_t *cp, int id_len)
{
int i;
static char id[sizeof("xxxx.xxxx.xxxx.yy-zz")];
char *pos = id;
for (i = 1; i <= SYSTEM_ID_LEN; i++) {
snprintf(pos, sizeof(id) - (pos - id), "%02x", *cp++);
pos += strlen(pos);
if (i == 2 || i == 4)
*pos++ = '.';
}
if (id_len >=... | cwe | CWE-125 | C/C++ |
package contexthandler
import (
"errors"
"net/http"
"github.com/grafana/grafana/pkg/login"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/user"
)
const InvalidJWT = "Invalid JWT"
const UserNotFound = "User not found"
func (h *ContextHandler) initContextWithJWT(ctx *models.ReqC... | cwe | CWE-200 | Go |
MagickBooleanType sixel_decode(unsigned char /* in */ *p, /* sixel bytes */
unsigned char /* out */ **pixels, /* decoded pixels */
size_t /* out */ *pwidth, /* image width */
... | cwe | CWE-119 | C/C++ |
RCoreSymCacheElement *r_coresym_cache_element_new(RBinFile *bf, RBuffer *buf, ut64 off, int bits, char * file_name) {
RCoreSymCacheElement *result = NULL;
ut8 *b = NULL;
RCoreSymCacheElementHdr *hdr = r_coresym_cache_element_header_new (buf, off, bits);
if (!hdr) {
return NULL;
}
if (hdr->version != 1) {
epri... | cwe | CWE-787 | C/C++ |
package com.salesmanager.shop.admin.controller.shipping;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils... | cwe | CWE-79 | Java |
public function delete($fileName = null)
{
$this->validateFileName();
list($name, $extension) = $this->model->getFileNameParts();
return $this->datasource->delete(
$this->model->getObjectTypeDirName(),
$name,
$extension
);
} | cwe | CWE-22 | PHP |
read_subpkt(cdk_stream_t inp, cdk_subpkt_t * r_ctx, size_t * r_nbytes)
{
byte c, c1;
size_t size, nread, n;
cdk_subpkt_t node;
cdk_error_t rc;
if (!inp || !r_nbytes)
return CDK_Inv_Value;
if (DEBUG_PKT)
_gnutls_write_log("read_subpkt:\n");
n = 0;
*r_nbytes = 0;
c = cdk_stream_getc(inp);
n++;
if (c == ... | cwe | CWE-125 | C/C++ |
Map1toN(SDL_PixelFormat * src, Uint8 Rmod, Uint8 Gmod, Uint8 Bmod, Uint8 Amod,
SDL_PixelFormat * dst)
{
Uint8 *map;
int i;
int bpp;
SDL_Palette *pal = src->palette;
bpp = ((dst->BytesPerPixel == 3) ? 4 : dst->BytesPerPixel);
map = (Uint8 *) SDL_malloc(pal->ncolors * bpp);
if (map ==... | cwe | CWE-787 | 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 |
int fscrypt_get_crypt_info(struct inode *inode)
{
struct fscrypt_info *crypt_info;
struct fscrypt_context ctx;
struct crypto_skcipher *ctfm;
const char *cipher_str;
int keysize;
u8 *raw_key = NULL;
int res;
res = fscrypt_initialize(inode->i_sb->s_cop->flags);
if (res)
return res;
if (!inode->i_... | cwe | CWE-476 | C/C++ |
function renderPipelineInstance(node_id, instance, node) {
var gui = '';
var stagesCount = 0;
gui += '<li class="instance">';
if (instance.label != '') {
if (isCurrent) {
gui += '<h4 title="' + instance.label + '"><span class="pipeline_run_label">Instance: ' +... | cwe | CWE-79 | JavaScript |
# Copyright (c), Michael DeHaan <michael.dehaan@gmail.com>, 2012-2013
# Copyright (c), Toshio Kuratomi <tkuratomi@ansible.com> 2016
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function
__metaclass__ =... | cwe | CWE-522 | Python |
WCHAR* VDir::MapPathW(const WCHAR *pInName)
{ /*
* possiblities -- relative path or absolute path with or without drive letter
* OR UNC name
*/
WCHAR szBuffer[(MAX_PATH+1)*2];
WCHAR szlBuf[MAX_PATH+1];
int length = wcslen(pInName);
if (!length)
return (WCHAR*)pInName;
if (length ... | cwe | CWE-125 | C/C++ |
static int aesni_cbc_hmac_sha256_cipher(EVP_CIPHER_CTX *ctx,
unsigned char *out,
const unsigned char *in, size_t len)
{
EVP_AES_HMAC_SHA256 *key = data(ctx);
unsigned int l;
size_t plen = key->payload_length, iv = 0, /* explicit... | cwe | CWE-310 | C/C++ |
validate_entries( bool ignore_invalid_entry ) {
HASHITER it = hash_iter_begin( ConfigTab, TABLESIZE );
unsigned int invalid_entries = 0;
MyString tmp;
MyString output = "The following configuration macros appear to contain default values that must be changed before Condor will run. These macros are:\n";
while( ! ... | cwe | CWE-134 | C/C++ |
void isis_notif_id_len_mismatch(const struct isis_circuit *circuit,
uint8_t rcv_id_len, const char *raw_pdu,
size_t raw_pdu_len)
{
const char *xpath = "/frr-isisd:id-len-mismatch";
struct list *arguments = yang_data_list_new();
char xpath_arg[XPATH_MAXLEN];
struct yang_data *data;
struct isis_area *area = ... | cwe | CWE-787 | Unknown |
int ossl_rsaz_mod_exp_avx512_x2(BN_ULONG *res1,
const BN_ULONG *base1,
const BN_ULONG *exp1,
const BN_ULONG *m1,
const BN_ULONG *rr1,
BN_ULONG k0_1,
... | cwe | CWE-787 | Unknown |
OMX_ERRORTYPE SoftVideoDecoderOMXComponent::getConfig(
OMX_INDEXTYPE index, OMX_PTR params) {
switch (index) {
case OMX_IndexConfigCommonOutputCrop:
{
OMX_CONFIG_RECTTYPE *rectParams = (OMX_CONFIG_RECTTYPE *)params;
if (rectParams->nPortIndex != kOutputPortIndex) {
... | cwe | CWE-119 | C/C++ |
static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id)
{
struct syscall_metadata *sys_data;
struct syscall_trace_enter *rec;
struct hlist_head *head;
int syscall_nr;
int rctx;
int size;
syscall_nr = trace_get_syscall_nr(current, regs);
if (syscall_nr < 0)
return;
if (!test_bit(syscall_n... | cwe | CWE-119 | Unknown |
int Reverb_command(effect_handle_t self,
uint32_t cmdCode,
uint32_t cmdSize,
void *pCmdData,
uint32_t *replySize,
void *pReplyData){
android::ReverbContext * pContext = (android::ReverbContext *) self;
int retsize;
LVREV_ControlParams_st ActiveParams; /* Current control Parameter... | cwe | CWE-119 | C/C++ |
void ParamTraits<SkBitmap>::Write(base::Pickle* m, const SkBitmap& p) {
size_t fixed_size = sizeof(SkBitmap_Data);
SkBitmap_Data bmp_data;
bmp_data.InitSkBitmapDataForTransfer(p);
m->WriteData(reinterpret_cast<const char*>(&bmp_data),
static_cast<int>(fixed_size));
size_t pixel_size = p.comput... | cwe | CWE-125 | C/C++ |
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2016 Namjae Jeon <linkinjeon@kernel.org>
* Copyright (C) 2018 Samsung Electronics Co., Ltd.
*/
#include <linux/inetdevice.h>
#include <net/addrconf.h>
#include <linux/syscalls.h>
#include <linux/namei.h>
#include <linux/statfs.h>
#include <linux/et... | cwe | CWE-401 | C/C++ |
static BOOL clear_decompress_subcode_rlex(wStream* s, UINT32 bitmapDataByteCount, UINT32 width,
UINT32 height, BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDstRel, UINT32 nYDstRel,
... | cwe | CWE-125 | C/C++ |
struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
struct dentry *new_dir, const char *new_name)
{
int error;
struct dentry *dentry = NULL, *trap;
const char *old_name;
trap = lock_rename(new_dir, old_dir);
/* Source or destination directories don't exist? */
if (d_really_is_negat... | cwe | CWE-362 | C/C++ |
/*
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2017 The PHP Group |
+---------... | cwe | CWE-400 | C/C++ |
int user_update(struct key *key, struct key_preparsed_payload *prep)
{
struct user_key_payload *zap = NULL;
int ret;
/* check the quota and attach the new data */
ret = key_payload_reserve(key, prep->datalen);
if (ret < 0)
return ret;
/* attach the new data, displacing the old */
key->expiry = prep->expiry;
... | cwe | CWE-20 | C/C++ |
static struct pending_op *pending_ccc_new(struct bt_att *att,
struct gatt_db_attribute *attrib,
uint16_t value,
uint8_t link_type)
{
struct pending_op *op;
struct btd_device *device;
device = att_get_device(att);
if (!device) {
error("Unable to find device object");
return NULL;
}
op = new0(s... | cwe | CWE-416 | Unknown |
App.main=function(b,f){function l(k){mxUtils.getAll("1"!=urlParams.dev?[k]:[k,STYLE_PATH+"/default.xml"],function(m){function q(){var n=null!=f?f():new App(new Editor("0"==urlParams.chrome||"min"==uiTheme,null,null,null,"0"!=urlParams.chrome));if(null!=window.mxscript){if("function"===typeof window.DropboxClient&&null=... | cwe | CWE-20 | JavaScript |
init: function (editorInstance) {
initPasteEvent(editorInstance);
var pluginName = 'base64image-dialog';
editorInstance.ui.addToolbarGroup('base64image', 'insert');
editorInstance.ui.addButton('base64image', {
label: editorInstance.lang.common.image,
command: pluginName,
toolbar: 'insert'
});
CKEDI... | cwe | CWE-434 | JavaScript |
static struct dir *squashfs_opendir(unsigned int block_start, unsigned int offset,
struct inode **i)
{
struct squashfs_dir_header dirh;
char buffer[sizeof(struct squashfs_dir_entry) + SQUASHFS_NAME_LEN + 1]
__attribute__((aligned));
struct squashfs_dir_entry *dire = (struct squashfs_dir_entry *) buffer;
long lon... | cwe | CWE-200 | Unknown |
static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags)
{
struct dentry *dir;
struct fscrypt_info *ci;
int dir_has_key, cached_with_key;
if (flags & LOOKUP_RCU)
return -ECHILD;
dir = dget_parent(dentry);
if (!d_inode(dir)->i_sb->s_cop->is_encrypted(d_inode(dir))) {
dput(dir);
return 0;
... | cwe | CWE-416 | Unknown |
char* dexOptGenerateCacheFileName(const char* fileName, const char* subFileName)
{
char nameBuf[512];
char absoluteFile[sizeof(nameBuf)];
const size_t kBufLen = sizeof(nameBuf) - 1;
const char* dataRoot;
char* cp;
/*
* Get the absolute path of the Jar or DEX file.
*/
absoluteFile[0] = '\0';
if (fi... | cwe | CWE-119 | C/C++ |
package com.salesmanager.shop.admin.controller.shipping;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import or... | cwe | CWE-639 | Java |
hivex_open (const char *filename, int flags)
{
hive_h *h = NULL;
assert (sizeof (struct ntreg_header) == 0x1000);
assert (offsetof (struct ntreg_header, csum) == 0x1fc);
h = calloc (1, sizeof *h);
if (h == NULL)
goto error;
h->msglvl = flags & HIVEX_OPEN_MSGLVL_MASK;
const char *debug = getenv ("H... | cwe | CWE-119 | C/C++ |
/*
* ALSA sequencer device management
* Copyright (c) 1999 by Takashi Iwai <tiwai@suse.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 of the License, or
* ... | cwe | CWE-416 | C/C++ |
mISDN_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t len, int flags)
{
struct sk_buff *skb;
struct sock *sk = sock->sk;
struct sockaddr_mISDN *maddr;
int copied, err;
if (*debug & DEBUG_SOCKET)
printk(KERN_DEBUG "%s: len %d, flags %x ch.nr %d, proto %x\n",
... | cwe | CWE-20 | C/C++ |
function suggestPassword(passwd_form)
{
// restrict the password to just letters and numbers to avoid problems:
// "editors and viewers regard the password as multiple words and
// things like double click no longer work"
var pwchars = "abcdefhjmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWYXZ";
var pas... | cwe | CWE-255 | JavaScript |
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/ory/fosite/handler/openid (interfaces: OpenIDConnectRequestStorage)
// Package internal is a generated GoMock package.
package internal
import (
context "context"
reflect "reflect"
gomock "github.com/golang/mock/gomock"
fosite "github.com/ory/fosi... | cwe | CWE-287 | Go |
int dtls1_accept(SSL *s)
{
BUF_MEM *buf;
unsigned long Time=(unsigned long)time(NULL);
void (*cb)(const SSL *ssl,int type,int val)=NULL;
unsigned long alg_k;
int ret= -1;
int new_state,state,skip=0;
int listen;
#ifndef OPENSSL_NO_SCTP
unsigned char sctpauthkey[64];
char labelbuffer[sizeof(DTLS1_SCTP_AUTH_LABE... | cwe | CWE-310 | Unknown |
//
// DNP3 was initially used over serial links; it defined its own application
// layer, transport layer, and data link layer. This hierarchy cannot be
// mapped to the TCP/IP stack directly. As a result, all three DNP3 layers
// are packed together as a single application layer payload over the TCP
// layer. Each DNP... | cwe | CWE-119 | C/C++ |
/*
* Copyright (c) 2009-2012, Salvatore Sanfilippo <antirez 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 conditions are met:
*
* * Redistributions of source code must retain the above co... | cwe | CWE-190 | C/C++ |
/**
* Copyright (c) 2006-2012, JGraph Ltd
*/
// Workaround for handling named HTML entities in mxUtils.parseXml
// LATER: How to configure DOMParser to just ignore all entities?
(function()
{
var entities = [
['nbsp', '160'],
['shy', '173']
];
var parseXml = mxUtils.parseXml;
mxUtils.parseXml = function... | cwe | CWE-79 | JavaScript |
/* IIP Server: Kakadu JPEG2000 handler
Initial development supported by Moravian Library in Brno (Moravska zemska
knihovna v Brne, http://www.mzk.cz/) R&D grant MK00009494301 & Old
Maps Online (http://www.oldmapsonline.org/) from the Ministry of
Culture of the Czech Republic.
Copyright (C) 2009... | cwe | CWE-190 | C/C++ |
package com.salesmanager.shop.admin.controller.shipping;
import com.salesmanager.core.business.services.reference.country.CountryService;
import com.salesmanager.core.business.services.shipping.ShippingService;
import com.salesmanager.core.business.utils.ProductPriceUtils;
import com.salesmanager.core.business.utils.a... | cwe | CWE-79 | Java |
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.shave=t()}(this,function(){"use strict";return function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(!t)throw Error("maxHeight is required");var i="string"=... | cwe | CWE-79 | JavaScript |
/**
* This file is part of the Gribbit Web Framework.
*
* https://github.com/lukehutch/gribbit
*
* @author Luke Hutchison
*
* --
*
* @license Apache 2.0
*
* Copyright 2015 Luke Hutchison
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in com... | cwe | CWE-346 | Java |
func Get(key string, lat string, long string, time string) *Forecast {
coord := lat + "," + long
var url string
if time == "now" {
url = BASEURL + "/" + key + "/" + coord + "?units=ca"
} else {
url = BASEURL + "/" + key + "/" + coord + "," + time + "?units=ca"
}
tr := &http.Transport{
TLSClientConfig: &tl... | cwe | CWE-295 | Go |
"use strict";
const sanitizeHtml = require("sanitize-html");
const initializeOptions = (options) => {
const sanitizerOptions = {};
if (Array.isArray(options.allowedTags) && options.allowedTags.length > 0) {
sanitizerOptions.allowedTags = options.allowedTags;
}
return {
allowedKeys:
(Array.isArra... | cwe | CWE-1321 | JavaScript |
static char *dex_resolve_library(const char *library) {
if (!library || library[0] != 'L') {
return NULL;
}
char *demangled = strdup(library + 1);
rz_str_replace_ch(demangled, '/', '.', 1);
demangled[strlen(demangled) - 1] = 0;
return demangled;
} | cwe | CWE-787 | Unknown |
void jas_matrix_asl(jas_matrix_t *matrix, int n)
{
int i;
int j;
jas_seqent_t *rowstart;
int rowstep;
jas_seqent_t *data;
if (jas_matrix_numrows(matrix) > 0 && jas_matrix_numcols(matrix) > 0) {
assert(matrix->rows_);
rowstep = jas_matrix_rowstep(matrix);
for (i = matrix->numrows_, rowstart = matrix->r... | cwe | CWE-190 | C/C++ |
def query(operation)
reply = session.query operation
@get_more_op.limit -= reply.count if limited?
@get_more_op.cursor_id = reply.cursor_id
@kill_cursor_op.cursor_ids = [reply.cursor_id]
reply.documents
end | cwe | CWE-20 | Ruby |
rb_dlhandle_sym(VALUE self, VALUE sym)
{
void (*func)();
struct dl_handle *dlhandle;
void *handle;
const char *name;
const char *err;
int i;
#if defined(HAVE_DLERROR)
# define CHECK_DLERROR if( err = dlerror() ){ func = 0; }
#else
# define CHECK_DLERROR
#endif
rb_secure(2);
name = Str... | cwe | CWE-20 | Unknown |
struct clock_source *dce110_clock_source_create(
struct dc_context *ctx,
struct dc_bios *bios,
enum clock_source_id id,
const struct dce110_clk_src_regs *regs,
bool dp_clk_src)
{
struct dce110_clk_src *clk_src =
kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
if (!clk_src)
return NULL;
if (dce110_clk_... | cwe | CWE-400 | Unknown |
def parse_json(raw_data):
''' this version for module return data only '''
orig_data = raw_data
# ignore stuff like tcgetattr spewage or other warnings
data = filter_leading_non_json_lines(raw_data)
try:
return json.loads(data)
except:
# not JSON, but try "Baby JSON" which all... | cwe | CWE-20 | Python |
Stream *Parser::makeStream(Object &&dict, Guchar *fileKey,
CryptAlgorithm encAlgorithm, int keyLength,
int objNum, int objGen, int recursion,
GBool strict) {
BaseStream *baseStr;
Stream *str;
Goffset length;
Goffset pos, endPos;
// get stream start position
lexer->ski... | cwe | CWE-190 | C/C++ |
decode_bytes_with_escapes(struct compiling *c, const node *n, const char *s,
size_t len)
{
return PyBytes_DecodeEscape(s, len, NULL, 0, NULL);
} | cwe | CWE-125 | C/C++ |
static inline void CheckEventLogging()
{
/*
Are we logging events?
*/
if (IsLinkedListEmpty(log_cache) != MagickFalse)
event_logging=MagickFalse;
else
{
LogInfo
*p;
ResetLinkedListIterator(log_cache);
p=(LogInfo *) GetNextValueInLinkedList(log_cache);
event_logging=p... | cwe | CWE-476 | C/C++ |
static int iwgif_read_image(struct iwgifrcontext *rctx)
{
int retval=0;
struct lzwdeccontext d;
size_t subblocksize;
int has_local_ct;
int local_ct_size;
unsigned int root_codesize;
if(!iwgif_read(rctx,rctx->rbuf,9)) goto done;
rctx->image_left = (int)iw_get_ui16le(&rctx->rbuf[0]);
rctx->image_top = (int)iw... | cwe | CWE-369 | Unknown |
protected Response attachToPost(Long messageKey, String filename, InputStream file, HttpServletRequest request) {
//load message
Message mess = fom.loadMessage(messageKey);
if(mess == null) {
return Response.serverError().status(Status.NOT_FOUND).build();
}
if(!forum.equalsByPersistableKey(mess.getForum()... | cwe | CWE-22 | 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 |
foreach ($post['fields'] as $abs_pos => $field) {
if ($current_cat != $post[$field . '_category']) {
//reset position when category has changed
$pos = 0;
//set new current category
$current_cat = $post[$field . '_category'];
}
... | cwe | CWE-79 | PHP |
# Copyright 2014 Netflix, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | cwe | CWE-601 | Python |
psutil_net_io_counters(PyObject *self, PyObject *args) {
kstat_ctl_t *kc = NULL;
kstat_t *ksp;
kstat_named_t *rbytes, *wbytes, *rpkts, *wpkts, *ierrs, *oerrs;
int ret;
int sock = -1;
struct lifreq ifr;
PyObject *py_retdict = PyDict_New();
PyObject *py_ifc_info = NULL;
if (py_ret... | cwe | CWE-415 | Unknown |
cif_print_page(gx_device_printer *pdev, gp_file *prn_stream)
{ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
int lnum;
byte *in = (byte *)gs_malloc(pdev->memory, line_size, 1, "cif_print_page(in)");
char *s;
int scanline, scanbyte;
int length, start; /* length ... | cwe | CWE-787 | C/C++ |
// mkerrors.sh -Wall -Werror -static -I/tmp/include
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build mipsle,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
package unix
import "syscall"
const (
B1000000 ... | cwe | CWE-287 | Go |
pkcs11dsa_parse(dst_key_t *key, isc_lex_t *lexer, dst_key_t *pub) {
dst_private_t priv;
isc_result_t ret;
int i;
pk11_object_t *dsa = NULL;
CK_ATTRIBUTE *attr;
isc_mem_t *mctx = key->mctx;
/* read private key file */
ret = dst__privstruct_parse(key, DST_ALG_DSA, lexer, mctx, &priv);
if (ret != ISC_R_SUCCESS)
... | cwe | CWE-617 | Unknown |
function errorMessage (er) {
var short = []
var detail = []
switch (er.code) {
case 'ENOAUDIT':
short.push(['audit', er.message])
break
case 'EAUDITNOPJSON':
short.push(['audit', er.message])
break
case 'EAUDITNOLOCK':
short.push(['audit', er.message])
detail.push([... | cwe | CWE-532 | JavaScript |
/*
* IPv6 library code, needed by static components when full IPv6 support is
* not configured or static. These functions are needed by GSO/GRO implementation.
*/
#include <linux/export.h>
#include <net/ip.h>
#include <net/ipv6.h>
#include <net/ip6_fib.h>
#include <net/addrconf.h>
#include <net/secure_seq.h>
#inclu... | cwe | CWE-200 | C/C++ |
static int stub_send_ret_submit(struct stub_device *sdev)
{
unsigned long flags;
struct stub_priv *priv, *tmp;
struct msghdr msg;
size_t txsize;
size_t total_size = 0;
while ((priv = dequeue_from_priv_tx(sdev)) != NULL) {
int ret;
struct urb *urb = priv->urb;
struct usbip_header pdu_header;
struct usbi... | cwe | CWE-476 | C/C++ |
def output
str = <<-INTERCOM_SCRIPT
<script id="IntercomSettingsScriptTag">
window.intercomSettings = #{ActiveSupport::JSON.encode(intercom_settings)};
</script>
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=docum... | cwe | CWE-79 | Ruby |
http_client_check_response_cb (SoupSession *session, SoupMessage *msg, gpointer user_data)
{
GError *error;
CheckData *data = user_data;
GTlsCertificateFlags cert_flags;
gboolean op_res;
gboolean using_https;
error = NULL;
op_res = FALSE;
if (msg->status_code == SOUP_STATUS_CANCELLED)
goto out;
... | cwe | CWE-310 | Unknown |
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import { mainPage } from "../../support/page_objects/mainPage";
export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`${apiType.toUpperCase()} api - Lock view`, () => {
/... | cwe | CWE-918 | JavaScript |
package org.linlinjava.litemall.wx.web;
import org.linlinjava.litemall.core.storage.StorageService;
import org.linlinjava.litemall.core.util.CharUtil;
import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.db.domain.LitemallStorage;
import org.linlinjava.litemall.db.service.LitemallStora... | cwe | CWE-22 | Java |
eb);this.updateSvgLinks(Da,ua,!0);this.addForeignObjectWarning(eb,Da);return Da}finally{Qa&&(this.useCssTransforms=!0,this.view.revalidate(),this.sizeDidChange())}};Graph.prototype.addForeignObjectWarning=function(z,L){if("0"!=urlParams["svg-warning"]&&0<L.getElementsByTagName("foreignObject").length){var M=z.createEle... | cwe | CWE-20 | JavaScript |
void IOBuf::allocExtBuffer(
std::size_t minCapacity,
uint8_t** bufReturn,
SharedInfo** infoReturn,
std::size_t* capacityReturn) {
size_t mallocSize = goodExtBufferSize(minCapacity);
auto buf = static_cast<uint8_t*>(checkedMalloc(mallocSize));
initExtBuffer(buf, mallocSize, infoReturn, capacityRetu... | cwe | CWE-787 | Unknown |
void IndexedDBTransaction::Abort(const IndexedDBDatabaseError& error) {
IDB_TRACE1("IndexedDBTransaction::Abort", "txn.id", id());
DCHECK(!processing_event_queue_);
if (state_ == FINISHED)
return;
UMA_HISTOGRAM_ENUMERATION("WebCore.IndexedDB.TransactionAbortReason",
ExceptionCod... | cwe | CWE-416 | C/C++ |
int snd_card_new(struct device *parent, int idx, const char *xid,
struct module *module, int extra_size,
struct snd_card **card_ret)
{
struct snd_card *card;
int err;
if (snd_BUG_ON(!card_ret))
return -EINVAL;
*card_ret = NULL;
if (extra_size < 0)
extra_size = 0;
card = kzalloc(sizeof(*card) + e... | cwe | CWE-399 | Unknown |
private Secret(String value) {
this.value = value;
} | cwe | CWE-326 | Java |
void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm)
{
newmm->uprobes_state.xol_area = NULL;
if (test_bit(MMF_HAS_UPROBES, &oldmm->flags)) {
set_bit(MMF_HAS_UPROBES, &newmm->flags);
/* unconditionally, dup_mmap() skips VM_DONTCOPY vmas */
set_bit(MMF_RECALC_UPROBES, &newmm->flags);
}
} | cwe | CWE-416 | Unknown |
/*
* FreeRTOS Kernel V10.4.2
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* 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, includ... | cwe | CWE-119 | C/C++ |
crypto_scrypt(const uint8_t * passwd, size_t passwdlen,
const uint8_t * salt, size_t saltlen, uint64_t N, uint32_t r, uint32_t p,
uint8_t * buf, size_t buflen)
{
void * B0, * V0, * XY0;
uint8_t * B;
uint32_t * V;
uint32_t * XY;
uint32_t i;
/* Sanity-check parameters. */
if (buflen > (((uint64_t)(... | cwe | CWE-787 | C/C++ |
lys_augment_free(struct ly_ctx *ctx, struct lys_node_augment *aug,
void (*private_destructor)(const struct lys_node *node, void *priv))
{
struct lys_node *next, *sub;
/* children from a resolved augment are freed under the target node */
if (!aug->target || (aug->flags & LYS_NOTAPPLIED)) {... | cwe | CWE-617 | Unknown |
function getDefaultShell(env) {
return env.ComSpec;
} | cwe | CWE-78 | JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.