code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
def karma_add(name):
karma = karma_ask(name)
db = db_connect()
cursor = db.cursor()
if karma is None:
try:
cursor.execute('''
INSERT INTO people(name,karma,shame) VALUES('{}',1,0)
'''.format(name))
db.commit()
logger.debug('Inse... | cwe | CWE-89 | Python |
int _gnutls_find_config_path(char *path, size_t max_size)
{
const char *home_dir = getenv("HOME");
if (home_dir != NULL && home_dir[0] != 0) {
snprintf(path, max_size, "%s/" CONFIG_PATH, home_dir);
return 0;
}
#ifdef _WIN32
if (home_dir == NULL || home_dir[0] == '\0') {
const char *home_drive = getenv("HOME... | cwe | CWE-20 | Unknown |
bool asn1_read_LDAPString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s)
{
int len;
len = asn1_tag_remaining(data);
if (len < 0) {
data->has_error = true;
return false;
}
*s = talloc_array(mem_ctx, char, len+1);
if (! *s) {
data->has_error = true;
return false;
}
asn1_read(data, *s, len);
(*s)[... | cwe | CWE-399 | Unknown |
static inline Quantum GetPixelChannel(const Image *magick_restrict image,
const PixelChannel channel,const Quantum *magick_restrict pixel)
{
if (image->channel_map[channel].traits == UndefinedPixelTrait)
return((Quantum) 0);
return(pixel[image->channel_map[channel].offset]);
} | cwe | CWE-20 | C/C++ |
handle_keywordonly_args(struct compiling *c, const node *n, int start,
asdl_seq *kwonlyargs, asdl_seq *kwdefaults)
{
PyObject *argname;
node *ch;
expr_ty expression, annotation;
arg_ty arg;
int i = start;
int j = 0; /* index for kwdefaults and kwonlyargs */
if (kwonl... | cwe | CWE-125 | C/C++ |
from django.apps import AppConfig
class AnymailBaseConfig(AppConfig):
name = 'anymail'
verbose_name = "Anymail"
def ready(self):
pass
| cwe | CWE-532 | Python |
/* Unicorn Emulator Engine */
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2015 */
/* Modified for Unicorn Engine by Chen Huitao<chenhuitao@hfmrit.com>, 2020 */
#if defined(UNICORN_HAS_OSXKERNEL)
#include <libkern/libkern.h>
#else
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#endif
#include <time.h> // na... | cwe | CWE-401 | C/C++ |
bool FontData::Bound(int32_t offset) {
if (offset > Size() || offset < 0)
return false;
bound_offset_ += offset;
return true;
} | cwe | CWE-189 | C/C++ |
package com.salesmanager.core.business.utils;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Currency;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
... | cwe | CWE-639 | Java |
sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
{
SDHCIState *s = (SDHCIState *)opaque;
unsigned shift = 8 * (offset & 0x3);
uint32_t mask = ~(((1ULL << (size * 8)) - 1) << shift);
uint32_t value = val;
value <<= shift;
switch (offset & ~0x3) {
case SDHC_SYSAD:
... | cwe | CWE-119 | C/C++ |
GF_Err gf_isom_set_extraction_slc(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, const GF_SLConfig *slConfig)
{
GF_TrackBox *trak;
GF_SampleEntryBox *entry;
GF_Err e;
GF_SLConfig **slc;
trak = gf_isom_get_track_from_file(the_file, trackNumber);
if (!trak) return GF_BAD_PARAM;
e = Media_GetS... | cwe | CWE-476 | C/C++ |
void ide_atapi_cmd_reply_end(IDEState *s)
{
int byte_count_limit, size, ret;
while (s->packet_transfer_size > 0) {
trace_ide_atapi_cmd_reply_end(s, s->packet_transfer_size,
s->elementary_transfer_size,
s->io_buffer_index);
... | cwe | CWE-125 | C/C++ |
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\... | cwe | CWE-119 | C/C++ |
protected function gdImageCreate($path,$mime){
switch($mime){
case 'image/jpeg':
return @imagecreatefromjpeg($path);
case 'image/png':
return @imagecreatefrompng($path);
case 'image/gif':
return @imagecreatefromgif($path);
case 'image/x-ms-bmp':
if (!function_exists('imagecreatefrombmp')) {... | cwe | CWE-89 | JavaScript |
/**
* @file
* POP network mailbox
*
* @authors
* Copyright (C) 2000-2002 Vsevolod Volkov <vvv@mutt.org.ua>
* Copyright (C) 2006-2007,2009 Rocco Rutte <pdmef@gmx.net>
*
* @copyright
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as ... | cwe | CWE-824 | C/C++ |
header_put_le_int (SF_PRIVATE *psf, int x)
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 4)
{ psf->header [psf->headindex++] = x ;
psf->header [psf->headindex++] = (x >> 8) ;
psf->header [psf->headindex++] = (x >> 16) ;
psf->header [psf->headindex++] = (x >> 24) ;
} ;
} /* header_put_le_int */ | cwe | CWE-787 | Unknown |
def self.save_sync_new_version(config, nodes, cluster_name, fetch_on_conflict, tokens={})
if not cluster_name or cluster_name.empty?
# we run on a standalone host, no config syncing
config.version += 1
config.save()
return true, {}
else
# we run in a cluster so we need to sync the ... | cwe | CWE-384 | Ruby |
static void gf_dump_vrml_dyn_field(GF_SceneDumper *sdump, GF_Node *node, GF_FieldInfo field, Bool has_sublist)
{
u32 i, sf_type;
void *slot_ptr;
if (gf_sg_vrml_is_sf_field(field.fieldType)) {
DUMP_IND(sdump);
if (sdump->XMLDump) {
if (sdump->X3DDump) {
gf_fprintf(sdump->trace, "<field name=\"%s\" type=\"... | cwe | CWE-476 | C/C++ |
/*
* Copyright (c) Facebook, Inc. and its 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/JSObject.h"
#include "hermes/VM/BuildMetadata.h"
#include "hermes/VM/Callable.h"
#include "hermes/VM/HostModel... | cwe | CWE-843 | C/C++ |
gs_heap_alloc_bytes(gs_memory_t * mem, uint size, client_name_t cname)
{
gs_malloc_memory_t *mmem = (gs_malloc_memory_t *) mem;
byte *ptr = 0;
#ifdef DEBUG
const char *msg;
static const char *const ok_msg = "OK";
# define set_msg(str) (msg = (str))
#else
# define set_msg(str) DO_NOTHING
#endif
... | cwe | CWE-189 | C/C++ |
compress_write(ds_file_t *file, const uchar *buf, size_t len)
{
ds_compress_file_t *comp_file;
ds_compress_ctxt_t *comp_ctxt;
comp_thread_ctxt_t *threads;
comp_thread_ctxt_t *thd;
uint nthreads;
uint i;
const char *ptr;
ds_file_t *dest_file;
comp_file = (ds_compress_file_t *) file->ptr;
comp_ctxt = com... | cwe | CWE-703 | Unknown |
private AuthnRequestParseResult parseRequest(byte[] xmlBytes) throws SAMLException {
String xml = new String(xmlBytes, StandardCharsets.UTF_8);
if (logger.isDebugEnabled()) {
logger.debug("SAMLRequest XML is\n{}", xml);
}
AuthnRequestParseResult result = new AuthnRequestParseResult();
result.... | cwe | CWE-611 | Java |
bool Cluster::EOS() const
//// long long element_size)
{
return (m_pSegment == NULL);
} | cwe | CWE-119 | C/C++ |
/**
* 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 |
static ssize_t ucma_write(struct file *filp, const char __user *buf,
size_t len, loff_t *pos)
{
struct ucma_file *file = filp->private_data;
struct rdma_ucm_cmd_hdr hdr;
ssize_t ret;
if (len < sizeof(hdr))
return -EINVAL;
if (copy_from_user(&hdr, buf, sizeof(hdr)))
return -EFAULT;
if (hdr.cmd >=... | cwe | CWE-264 | C/C++ |
int mainloop(CLIENT *client) {
struct nbd_request request;
struct nbd_reply reply;
gboolean go_on=TRUE;
#ifdef DODBG
int i = 0;
#endif
negotiate(client->net, client, NULL);
DEBUG("Entering request loop!\n");
reply.magic = htonl(NBD_REPLY_MAGIC);
reply.error = 0;
while (go_on) {
char buf[BUFSIZE];
size_t le... | cwe | CWE-119 | C/C++ |
static char *parse_note(char *p,
int flags)
{
struct SYMBOL *s;
char *q;
int pit = 0, len, acc, nostem, chord, j, m, n;
if (flags & ABC_F_GRACE) { /* in a grace note sequence */
s = abc_new(ABC_T_NOTE, NULL);
} else {
s = abc_new(ABC_T_NOTE, gchord);
if (gchord)
gchord = NULL;
}
s->flags |= flags;
... | cwe | CWE-787 | Unknown |
/*
* Copyright (c) 2009-2020, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2020, Redis Labs, Inc
* 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 ... | cwe | CWE-404 | C/C++ |
unsigned long X509_issuer_and_serial_hash(X509 *a)
{
unsigned long ret = 0;
EVP_MD_CTX *ctx = EVP_MD_CTX_new();
unsigned char md[16];
char *f;
if (ctx == NULL)
goto err;
f = X509_NAME_oneline(a->cert_info.issuer, NULL, 0);
if (!EVP_DigestInit_ex(ctx, EVP_md5(), NULL))
goto e... | cwe | CWE-476 | Unknown |
static int tower_probe (struct usb_interface *interface, const struct usb_device_id *id)
{
struct device *idev = &interface->dev;
struct usb_device *udev = interface_to_usbdev(interface);
struct lego_usb_tower *dev = NULL;
struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor* endpoint;
struct tow... | cwe | CWE-476 | C/C++ |
/*
etterfilter -- the actual compiler
Copyright (C) ALoR & NaGA
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later... | cwe | CWE-125 | C/C++ |
package libproxy
import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"mime/multipart"
"net/http"
"net/url"
"strconv"
"strings"
"github.com/google/uuid"
)
type statusChangeFunction func(status string, isListening bool)
var (
accessToken string
sessionFingerprint stri... | cwe | CWE-918 | Go |
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-416 | Python |
void ACLosslessScan::ParseMCU(struct Line **prev,struct Line **top)
{
#if ACCUSOFT_CODE
UBYTE c;
//
// Parse a single MCU, which is now a group of pixels.
for(c = 0;c < m_ucCount;c++) {
struct QMContextSet &contextset = m_Context[m_ucContext[c]];
struct Line *line = top[c];
struct Line *pline= prev... | cwe | CWE-617 | C/C++ |
/*
* Description:
* History: yang@haipo.me, 2016/03/30, create
*/
# include <stdlib.h>
# include <assert.h>
# include "ut_rpc.h"
# include "ut_crc32.h"
# include "ut_misc.h"
int rpc_decode(nw_ses *ses, void *data, size_t max)
{
if (max < RPC_PKG_HEAD_SIZE)
return 0;
rpc_pkg *pkg = data;
... | cwe | CWE-190 | C/C++ |
package samlsp
import (
"context"
"encoding/xml"
"errors"
"io/ioutil"
"net/http"
"net/url"
"github.com/crewjam/httperr"
"github.com/crewjam/saml"
)
// ParseMetadata parses arbitrary SAML IDP metadata.
//
// Note: this is needed because IDP metadata is sometimes wrapped in
// an <EntitiesDescriptor>, and som... | cwe | CWE-287 | Go |
results.push({'rkey':rkey, 'tags': getTagsFromKey(rkey), 'imgIds':rIds});
// Update the UI
var $toRemove = $('tr:has(.img_panel)', $this);
// For each Tag combination... (E.g. 'Metaphase'+'Dead')
var topLevelTag = "";
var $td, $tr;
... | cwe | CWE-116 | JavaScript |
HandleRFBServerMessage(rfbClient* client)
{
rfbServerToClientMsg msg;
if (client->serverPort==-1)
client->vncRec->readTimestamp = TRUE;
if (!ReadFromRFBServer(client, (char *)&msg, 1))
return FALSE;
switch (msg.type) {
case rfbSetColourMapEntries:
{
/* TODO:
int i;
uint16_t rgb[3];
... | cwe | CWE-703 | Unknown |
static void construct_get_dest_keyring(struct key **_dest_keyring)
{
struct request_key_auth *rka;
const struct cred *cred = current_cred();
struct key *dest_keyring = *_dest_keyring, *authkey;
kenter("%p", dest_keyring);
/* find the appropriate keyring */
if (dest_keyring) {
/* the caller supplied on... | cwe | CWE-862 | C/C++ |
int ssl_get_prev_session(SSL *s, unsigned char *session_id, int len,
const unsigned char *limit)
{
/* This is used only by servers. */
SSL_SESSION *ret = NULL;
int fatal = 0;
int try_session_cache = 1;
#ifndef OPENSSL_NO_TLSEXT
int r;
#endif
if (session_id + len > limi... | cwe | CWE-190 | Unknown |
decode_NXAST_RAW_ENCAP(const struct nx_action_encap *nae,
enum ofp_version ofp_version OVS_UNUSED,
struct ofpbuf *out)
{
struct ofpact_encap *encap;
const struct ofp_ed_prop_header *ofp_prop;
size_t props_len;
uint16_t n_props = 0;
int err;
encap = ... | cwe | CWE-416 | Unknown |
n)for(v=0;v<n.length;v++)n[v].node.style.visibility=c?"visible":"hidden"};var f=mxGuide.prototype.destroy;mxGuide.prototype.destroy=function(){f.call(this);var c=this.guidesArrVer,m=this.guidesArrHor;if(null!=c){for(var n=0;n<c.length;n++)c[n].destroy();this.guidesArrVer=null}if(null!=m){for(n=0;n<m.length;n++)m[n].des... | cwe | CWE-20 | JavaScript |
0;e<this.pages.length;e++)this.updatePageRoot(this.pages[e]),this.addBasenamesForCell(this.pages[e].root,c);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),c);e=[];for(var g in c)e.push(g);return e};EditorUi.prototype.addBasenamesForCell=function(c,e){function g(v){if(null!=v){var x=v.lastIndexOf(".");0... | cwe | CWE-20 | JavaScript |
/* ecc-eh-to-a.c
Copyright (C) 2014 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the Lic... | cwe | CWE-787 | C/C++ |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
auto* params =
reinterpret_cast<TfLiteResizeNearestNeighborParams*>(node->builtin_data);
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
const TfLiteTensor* siz... | cwe | CWE-125 | C/C++ |
var CC = require('config-chain').ConfigChain
var inherits = require('inherits')
var configDefs = require('./defaults.js')
var types = configDefs.types
var once = require('once')
var fs = require('fs')
var path = require('path')
var nopt = require('nopt')
var ini = require('ini')
var Umask = configDefs.Umask
var correct... | cwe | CWE-284 | JavaScript |
void WebPImage::doWriteMetadata(BasicIo& outIo)
{
if (!io_->isopen()) throw Error(kerInputDataReadFailed);
if (!outIo.isopen()) throw Error(kerImageWriteFailed);
#ifdef EXIV2_DEBUG_MESSAGES
std::cout << "Writing metadata" << std::endl;
#endif
byte data [WEBP_TAG_SIZE*3];
... | cwe | CWE-703 | C/C++ |
query_io (struct query *z, iopause_fd *x, struct taia *deadline)
{
dns_transmit_io (&z->dt, x, deadline);
} | cwe | CWE-362 | Unknown |
MediaStreamDispatcherHost::~MediaStreamDispatcherHost() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
bindings_.CloseAllBindings();
CancelAllRequests();
} | cwe | CWE-189 | C/C++ |
static int zrle_send_framebuffer_update(VncState *vs, int x, int y,
int w, int h)
{
bool be = vs->client_be;
size_t bytes;
int zywrle_level;
if (vs->zrle.type == VNC_ENCODING_ZYWRLE) {
if (!vs->vd->lossy || vs->tight.quality == (uint8_t)-1
|| ... | cwe | CWE-401 | Unknown |
def get(self, id, project=None):
if not project:
project = g.project
return (
Person.query.filter(Person.id == id)
.filter(Project.id == project.id)
.one()
) | cwe | CWE-863 | Python |
/*
* Dragonfly - Runtime dependency management library
* Copyright (c) 2021 Joshua Sing <joshua@hypera.dev>
*
* 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, in... | cwe | CWE-611 | Java |
static void ctcp_msg_dcc_chat(IRC_SERVER_REC *server, const char *data,
const char *nick, const char *addr,
const char *target, CHAT_DCC_REC *chat)
{
CHAT_DCC_REC *dcc;
char **params;
int paramcount;
int passive, autoallow = FALSE;
/* CHAT <unused> <address> <port> */
/* CH... | cwe | CWE-416 | Unknown |
public function edit()
{
$currentUser = $this->User->find('first', array(
'conditions' => array('User.id' => $this->Auth->user('id')),
'recursive' => -1
));
if (empty($currentUser)) {
throw new NotFoundException('Something went wrong. Your user account cou... | cwe | CWE-287 | PHP |
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;
unsigned long i;
struct kvm_memory_slot *memslot;
struct kvm_memory_slot old, new;
struct kvm_memslots *slots, *old_memslots;
r = check_memory_regio... | cwe | CWE-399 | C/C++ |
net_bind(short unsigned *port, int type, const char *log_service_name)
{
struct addrinfo hints = { 0 };
struct addrinfo *servinfo;
struct addrinfo *ptr;
const char *cfgaddr;
char addr[INET6_ADDRSTRLEN];
char strport[8];
int yes = 1;
int no = 0;
int fd;
int ret;
cfgaddr = cfg_getstr(cfg_getsec(cfg... | cwe | CWE-416 | C/C++ |
ReverbConvolverStage::ReverbConvolverStage(const float* impulseResponse, size_t, size_t reverbTotalLatency, size_t stageOffset, size_t stageLength,
size_t fftSize, size_t renderPhase, size_t renderSliceSize, ReverbAccumulationBuffer* accumulationBuffer, bool directMode)
: ... | cwe | CWE-119 | C/C++ |
Status PySeqToTensor(PyObject* obj, DataType dtype, Tensor* ret) {
ConverterState state;
TF_RETURN_IF_ERROR(InferShapeAndType(obj, &state));
DataType requested_dtype = DT_INVALID;
if (dtype != DT_INVALID) {
requested_dtype = dtype;
}
// NOTE(josh11b): If don't successfully convert to the requested type,... | cwe | CWE-20 | C/C++ |
bool BitReaderCore::ReadBitsInternal(int num_bits, uint64_t* out) {
DCHECK_GE(num_bits, 0);
if (num_bits == 0) {
*out = 0;
return true;
}
if (num_bits > nbits_ && !Refill(num_bits)) {
nbits_ = 0;
reg_ = 0;
return false;
}
bits_read_ += num_bits;
if (num_bits == kRegWidthInBits... | cwe | CWE-908 | C/C++ |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-399 | C/C++ |
static void print_maps(struct pid_info_t* info)
{
FILE *maps;
size_t offset;
char device[10];
long int inode;
char file[PATH_MAX];
strlcat(info->path, "maps", sizeof(info->path));
maps = fopen(info->path, "r");
if (!maps)
goto out;
while (fscanf(maps, "%*x-%*x ... | cwe | CWE-20 | C/C++ |
/* -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/*
Copyright 2011 notmasteryet
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obt... | cwe | CWE-835 | JavaScript |
static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
BMPInfo
bmp_info;
Image
*image;
IndexPacket
index;
MagickBooleanType
status;
MagickOffsetType
offset,
start_position;
MemoryInfo
*pixel_info;
register IndexPacket
*indexes;
register ... | cwe | CWE-835 | C/C++ |
def deliver!(mail)
if ::File.respond_to?(:makedirs)
::File.makedirs settings[:location]
else
::FileUtils.mkdir_p settings[:location]
end
mail.destinations.uniq.each do |to|
::File.open(::File.join(settings[:location], to), 'a') { |f| "#{f.write(mail.encoded)}\r\n\r\n" }
... | cwe | CWE-22 | Ruby |
cvtchar(register const char *sp)
/* convert a character to a terminfo push */
{
unsigned char c = 0;
int len;
switch (*sp) {
case '\\':
switch (*++sp) {
case '\'':
case '$':
case '\\':
case '%':
c = UChar(*sp);
len = 2;
break;
case '\0':
c = '\\';
len = 1;
break;
ca... | cwe | CWE-787 | Unknown |
import logging
import urllib
from typing import Any, Dict, List, Optional
from urllib.parse import urlencode
from django.conf import settings
from django.contrib.auth import authenticate, get_backends
from django.core import validators
from django.core.exceptions import ValidationError
from django.db.models import Q
f... | cwe | CWE-863 | Python |
int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb)
{
int ret;
int size;
if (ud->side == USBIP_STUB) {
/* the direction of urb must be OUT. */
if (usb_pipein(urb->pipe))
return 0;
size = urb->transfer_buffer_length;
} else {
/* the direction of urb must be IN. */
if (usb_pipeout(urb->pipe)... | cwe | CWE-119 | Unknown |
int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
unsigned int *pipelens, unsigned int numpipes,
int create_empty_fragment)
{
unsigned char *outbuf[SSL_MAX_PIPELINES], *plen[SSL_MAX_PIPELINES];
SSL3_RECORD wr[SSL_MAX_PIPELINES];
int i, mac_size, clear = 0;
... | cwe | CWE-20 | C/C++ |
package jsonpatch
import (
"bytes"
"encoding/json"
"fmt"
"strconv"
"strings"
)
const (
eRaw = iota
eDoc
eAry
)
type lazyNode struct {
raw *json.RawMessage
doc partialDoc
ary partialArray
which int
}
type operation map[string]*json.RawMessage
// Patch is an ordered collection of operations.
type P... | cwe | CWE-787 | Go |
struct resource_pool *dce112_create_resource_pool(
uint8_t num_virtual_links,
struct dc *dc)
{
struct dce110_resource_pool *pool =
kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL);
if (!pool)
return NULL;
if (construct(num_virtual_links, dc, pool))
return &pool->base;
BREAK_TO_DEBUGGER();
return... | cwe | CWE-400 | Unknown |
read_attribute(cdk_stream_t inp, size_t pktlen, cdk_pkt_userid_t attr,
int name_size)
{
const byte *p;
byte *buf;
size_t len, nread;
cdk_error_t rc;
if (!inp || !attr || !pktlen)
return CDK_Inv_Value;
if (DEBUG_PKT)
_gnutls_write_log("read_attribute: %d octets\n",
(int) pktlen);
_gnutls_str_... | cwe | CWE-119 | C/C++ |
public function enableCurrency(TransactionCurrency $currency)
{
app('preferences')->mark();
$this->repository->enable($currency);
session()->flash('success', (string)trans('firefly.currency_is_now_enabled', ['name' => $currency->name]));
Log::channel('audit')->info(sprintf('Enabled ... | cwe | CWE-352 | PHP |
function initialize() {
// Our default tooltip configuration. For this, one simply needs to:
// * Set `class="tippy-zulip-tooltip"` on an element for enable this.
// * Set `data-tippy-content="{{t 'Tooltip content' }}"`, often
// replacing a `title` attribute on an element that had both.
// * Set ... | cwe | CWE-79 | JavaScript |
bool WebGLImageConversion::ExtractTextureData(unsigned width,
unsigned height,
GLenum format,
GLenum type,
unsigned unpack_alignment,
... | cwe | CWE-119 | C/C++ |
return txt.replace(/[&<>]/gm, (str) => {
if (str === "&") return "&";
if (str === "<") return "<";
if (str === ">") return ">";
}); | cwe | CWE-79 | JavaScript |
static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
unsigned int len;
unsigned long start=0, off;
struct au1200fb_device *fbdev = info->par;
if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) {
return -EINVAL;
}
start = fbdev->fb_phys & PAGE_MASK;
len = PAGE_ALIGN((start & ~PAGE_MASK) + ... | cwe | CWE-119 | C/C++ |
package logic
import (
"errors"
"time"
"github.com/golang-jwt/jwt/v4"
"github.com/gravitl/netmaker/models"
"github.com/gravitl/netmaker/servercfg"
)
var jwtSecretKey = []byte("(BytesOverTheWire)")
// CreateJWT func will used to create the JWT while signing in and signing out
func CreateJWT(uuid string, macAddr... | cwe | CWE-798 | Go |
static void gf_m2ts_process_pat(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *ses, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)
{
GF_M2TS_Program *prog;
GF_M2TS_SECTION_ES *pmt;
u32 i, nb_progs, evt_type;
u32 nb_sections;
u32 data_size;
unsigned char *data;
G... | cwe | CWE-416 | C/C++ |
package server
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"time"
"github.com/pkg/errors"
"github.com/usememos/memos/api"
"github.com/usememos/memos/common"
metric "github.com/usememos/memos/plugin/metrics"
"github.com/labstack/echo/v4"
)
const (
// The max file size is 32MB.
ma... | cwe | CWE-79 | Go |
static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx,
const uint8_t *data,
unsigned int data_sz,
void *user_priv,
long deadline)
{
vpx_codec_err_t res = VPX_CODEC_OK;
unsigned int resolution_change = 0;
unsigned int w, h;
if (!ctx->fragments.enabled && (data == NULL && data... | cwe | CWE-20 | C/C++ |
static bool reconstruct_chained_fixup(struct MACH0_(obj_t) *bin) {
if (!bin->dyld_info) {
return false;
}
if (!bin->nsegs) {
return false;
}
bin->chained_starts = R_NEWS0 (struct r_dyld_chained_starts_in_segment *, bin->nsegs);
if (!bin->chained_starts) {
return false;
}
size_t wordsize = get_word_size (b... | cwe | CWE-125 | Unknown |
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{
// GAE can't serve dot prefixed folders
String uri = request.getRequestURI().replace("/.", "/");
if (uri.toLowerCase().contains(".json"))
{
response.setCont... | cwe | CWE-22 | Java |
import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc'
import { saveAs } from 'file-saver'
import { FlowRouter } from 'meteor/ostrio:flow-router-extra'
import { NullXlsx } from '@neovici/nullxlsx'
import './periodtimetable.html'
import './pagination.js'
import './limitpicker.js'
import { i18nReady, t } from '../.... | cwe | CWE-1236 | JavaScript |
package main
import (
"context"
"fmt"
"net"
"os"
"os/signal"
"runtime/debug"
"strconv"
"sync"
"time"
"github.com/gravitl/netmaker/auth"
controller "github.com/gravitl/netmaker/controllers"
"github.com/gravitl/netmaker/database"
"github.com/gravitl/netmaker/functions"
nodepb "github.com/gravitl/netmaker/... | cwe | CWE-798 | Go |
PJ_DEF(pj_status_t) pjmedia_rtcp_fb_build_sli(
pjmedia_rtcp_session *session,
void *buf,
pj_size_t *length,
unsigned sli_cnt,
const pjmedia_rtcp_fb_sli sli[])
{
pjmedia_rtcp_common *hdr;
pj_uint8_t *p;
unsigned len, i;
PJ_ASSERT_RETURN(session && buf && length && sli_cnt && sl... | cwe | CWE-787 | C/C++ |
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-787 | C/C++ |
/**
* Copyright (c) 2006-2012, JGraph Ltd
*/
/**
* Constructs a new graph editor
*/
EditorUi = function(editor, container, lightbox)
{
mxEventSource.call(this);
this.destroyFunctions = [];
this.editor = editor || new Editor();
this.container = container || document.body;
var graph = this.editor.graph;
gra... | cwe | CWE-94 | JavaScript |
static int _open_and_activate_luks2(struct crypt_device *cd,
int keyslot,
const char *name,
const char *passphrase,
size_t passphrase_size,
uint32_t flags)
{
crypt_reencrypt_info ri;
int r;
struct luks2_hdr *hdr = &cd->u.luks2.hdr;
ri = LUKS2_reencrypt_status(hdr);
if (ri == CRYPT_REENCRYPT_INVALID)
return... | cwe | CWE-345 | Unknown |
function merge(dst, ...sources) {
for (src of sources) {
for (let key in src) {
let s = src[key], d = dst[key]
if (Object(s) == s && Object(d) === d) {
dst[key] = merge(d, s)
continue
}
dst[key] = src[key]
}
}
return dst
} | cwe | CWE-1321 | JavaScript |
static void format_expand_code(const char **format, GString *out, int *flags)
{
int set;
if (flags == NULL) {
/* flags are being ignored - skip the code */
while (**format != ']')
(*format)++;
return;
}
set = TRUE;
(*format)++;
while (**format != ']' && **format != '\0') {
if (**format == '+')
set... | cwe | CWE-476 | Unknown |
size_t http_parser_execute (http_parser *parser,
const http_parser_settings *settings,
const char *data,
size_t len)
{
char c, ch;
int8_t unhex_val;
const char *p = data;
const char *header_field_mark = 0;
const char *header_v... | cwe | CWE-444 | Unknown |
nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
struct nfsd3_readdirargs *args)
{
p = decode_fh(p, &args->fh);
if (!p)
return 0;
p = xdr_decode_hyper(p, &args->cookie);
args->verf = p; p += 2;
args->dircount = ~0;
args->count = ntohl(*p++);
args->count = min_t(u32, args->count, PAGE_... | cwe | CWE-404 | C/C++ |
function l(t,e,n){return(e=g(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t} | cwe | CWE-79 | JavaScript |
std::vector<Option> get_rgw_options() {
return std::vector<Option>({
Option("rgw_acl_grants_max_num", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(100)
.set_description("Max number of ACL grants in a single request"),
Option("rgw_rados_tracing", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
... | cwe | CWE-770 | Unknown |
int tls1_setup_key_block(SSL *s)
{
unsigned char *p;
const EVP_CIPHER *c;
const EVP_MD *hash;
int num;
SSL_COMP *comp;
int mac_type = NID_undef, mac_secret_size = 0;
int ret = 0;
if (s->s3->tmp.key_block_length != 0)
return (1);
if (!ssl_cipher_get_evp
(s->sessio... | cwe | CWE-20 | C/C++ |
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under ... | cwe | CWE-22 | C/C++ |
static MagickBooleanType SetGrayscaleImage(Image *image,
ExceptionInfo *exception)
{
CacheView
*image_view;
MagickBooleanType
status;
PixelInfo
*colormap;
register ssize_t
i;
ssize_t
*colormap_index,
j,
y;
assert(image != (Image *) NULL);
assert(image->signature == Magic... | cwe | CWE-772 | Unknown |
static OPJ_BOOL opj_pi_next_pcrl(opj_pi_iterator_t * pi)
{
opj_pi_comp_t *comp = NULL;
opj_pi_resolution_t *res = NULL;
OPJ_UINT32 index = 0;
if (pi->poc.compno0 >= pi->numcomps ||
pi->poc.compno1 >= pi->numcomps + 1) {
opj_event_msg(pi->manager, EVT_ERROR,
"op... | cwe | CWE-125 | Unknown |
/*
* Cantata
*
* Copyright (c) 2011-2018 Craig Drummond <craig.p.drummond@gmail.com>
*
* ----
*
* 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
* (a... | cwe | CWE-20 | C/C++ |
DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name, bool defaultDeleteFiles): QDialog(parent) {
setupUi(this);
if (size == 1)
label->setText(tr("Are you sure you want to delete '%1' from the transfer list?", "Are you sure you want to delete 'ubuntu-linux-iso' from the transfer l... | cwe | CWE-79 | C/C++ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.