code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
import datetime
import logging
import re
from flask import abort, current_app, flash, g, redirect, request, session, url_for
from flask_babel import lazy_gettext
from flask_login import login_user, logout_user
import jwt
from werkzeug.security import generate_password_hash
from wtforms import PasswordField, validators... | cwe | CWE-601 | Python |
public void testUpdateMapper_serializade() {
//create a mapper
String mapperId = UUID.randomUUID().toString();
String sessionId = UUID.randomUUID().toString().substring(0, 32);
PersistentMapper sMapper = new PersistentMapper("mapper-to-persist-bis");
PersistedMapper pMapper = mapperDao.persistMapper(sessionId... | cwe | CWE-91 | Java |
static int uas_use_uas_driver(struct usb_interface *intf,
const struct usb_device_id *id,
unsigned long *flags_ret)
{
struct usb_host_endpoint *eps[4] = { };
struct usb_device *udev = interface_to_usbdev(intf);
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
unsigned long flags = id->driver_info;
in... | cwe | CWE-125 | C/C++ |
MOBI_RET mobi_parse_huffdic(const MOBIData *m, MOBIHuffCdic *huffcdic) {
MOBI_RET ret;
const size_t offset = mobi_get_kf8offset(m);
if (m->mh == NULL || m->mh->huff_rec_index == NULL || m->mh->huff_rec_count == NULL) {
debug_print("%s", "HUFF/CDIC records metadata not found in MOBI header\n");
... | cwe | CWE-119 | C/C++ |
sanitizeHtmlLight: function (value) {
value = value || '';
value = value.replace(/<[\/]{0,1}(base)[^><]*>/gi, '');
value = value.replace(/<[\/]{0,1}(object)[^><]*>/gi, '');
value = value.replace(/<[\/]{0,1}(embed)[^><]*>/gi, '');
value = value.replace(/<[\/]{0... | cwe | CWE-79 | JavaScript |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TfLitePackParams* data =
reinterpret_cast<TfLitePackParams*>(node->builtin_data);
TF_LITE_ENSURE_EQ(context, NumInputs(node), data->values_count);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* input0 = GetInput(conte... | cwe | CWE-787 | C/C++ |
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
| Copyrigh... | cwe | CWE-119 | C/C++ |
TfLiteStatus InitializeTemporaries(TfLiteContext* context, TfLiteNode* node,
OpContext* op_context) {
// Creates a temp index to iterate through input data.
OpData* op_data = reinterpret_cast<OpData*>(node->user_data);
TfLiteIntArrayFree(node->temporaries);
node->temporaries =... | cwe | CWE-125 | C/C++ |
static UINT gdi_SurfaceToCache(RdpgfxClientContext* context,
const RDPGFX_SURFACE_TO_CACHE_PDU* surfaceToCache)
{
const RECTANGLE_16* rect;
gdiGfxSurface* surface;
gdiGfxCacheEntry* cacheEntry;
UINT rc = ERROR_INTERNAL_ERROR;
EnterCriticalSection(&context->mux);
rect = &(surfaceToCa... | cwe | CWE-190 | Unknown |
'use strict'
const assert = require('assert')
const { kDestroyed, kBodyUsed } = require('./symbols')
const { IncomingMessage } = require('http')
const stream = require('stream')
const net = require('net')
const { InvalidArgumentError } = require('./errors')
const { Blob } = require('buffer')
const nodeUtil = require('... | cwe | CWE-918 | JavaScript |
file_transfer_t *imcb_file_send_start(struct im_connection *ic, char *handle, char *file_name, size_t file_size)
{
bee_t *bee = ic->bee;
bee_user_t *bu = bee_user_by_handle(bee, ic, handle);
if (bee->ui->ft_in_start) {
return bee->ui->ft_in_start(bee, bu, file_name, file_size);
} else {
return NULL;
}
} | cwe | CWE-476 | C/C++ |
/*
Copyright 2019 The KubeEdge 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 in writing, so... | cwe | CWE-476 | Go |
int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
{
int i,n=0,len,nid, first, use_bn;
BIGNUM *bl;
unsigned long l;
const unsigned char *p;
char tbuf[DECIMAL_SIZE(i)+DECIMAL_SIZE(l)+2];
if ((a == NULL) || (a->data == NULL)) {
buf[0]='\0';
return(0);
}
if (!no_name && (nid=OBJ_obj2... | cwe | CWE-200 | Unknown |
FUNC_DECODER(dissector_postgresql)
{
DECLARE_DISP_PTR(ptr);
struct ec_session *s = NULL;
void *ident = NULL;
char tmp[MAX_ASCII_ADDR_LEN];
struct postgresql_status *conn_status;
/* don't complain about unused var */
(void) DECODE_DATA;
(void) DECODE_DATALEN;
(void) DECODED_LEN;
if (F... | cwe | CWE-119 | C/C++ |
scrub_normalize(sldns_buffer* pkt, struct msg_parse* msg,
struct query_info* qinfo, struct regional* region)
{
uint8_t* sname = qinfo->qname;
size_t snamelen = qinfo->qname_len;
struct rrset_parse* rrset, *prev, *nsset=NULL;
if(FLAGS_GET_RCODE(msg->flags) != LDNS_RCODE_NOERROR &&
FLAGS_GET_RCODE(msg->flags) !=... | cwe | CWE-400 | Unknown |
package httpauth
import (
"context"
"errors"
"github.com/dgrijalva/jwt-go"
"github.com/ntbosscher/gobase/auth"
"github.com/ntbosscher/gobase/auth/httpauth/oauth"
"github.com/ntbosscher/gobase/env"
"github.com/ntbosscher/gobase/res"
"github.com/ntbosscher/gobase/strs"
"io/ioutil"
"log"
"net/http"
"strings"
... | cwe | CWE-362 | Go |
// Copyright 2009 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.
// +build ignore
/*
Input to cgo -godefs. See README.md
*/
// +godefs map struct_in_addr [4]byte /* in_addr */
// +godefs map struct_in6_addr [16]byte /* in6... | cwe | CWE-287 | Go |
generate_a_aaaa_check(struct module_qstate* qstate, struct iter_qstate* iq,
int id)
{
struct iter_env* ie = (struct iter_env*)qstate->env->modinfo[id];
struct module_qstate* subq;
size_t i;
struct reply_info* rep = iq->response->rep;
struct ub_packed_rrset_key* s;
log_assert(iq->dp);
if(iq->depth == ie->max_d... | cwe | CWE-400 | Unknown |
void Compute(OpKernelContext* ctx) override {
const Tensor& input = ctx->input(0);
const float input_min_float = ctx->input(1).flat<float>()(0);
const float input_max_float = ctx->input(2).flat<float>()(0);
Tensor* output_min = nullptr;
OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({}), &o... | cwe | CWE-125 | Unknown |
static void mpeg4_encode_gop_header(MpegEncContext *s)
{
int hours, minutes, seconds;
int64_t time;
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, GOP_STARTCODE);
time = s->current_picture_ptr->f->pts;
if (s->reordered_input_picture[1])
time = FFMIN(time, s->reordered_input_picture[1]->... | cwe | CWE-20 | Unknown |
int fr_dhcp_decode(RADIUS_PACKET *packet)
{
int i;
uint8_t *p, *next;
uint32_t giaddr;
VALUE_PAIR *head, *vp, **tail;
VALUE_PAIR *maxms, *mtu;
char buffer[2048];
head = NULL;
tail = &head;
p = packet->data;
if ((fr_debug_flag > 2) && fr_log_fp) {
for (i = 0; i < packet->data_len; i++) {
if ((i & 0x0f)... | cwe | CWE-399 | C/C++ |
TfLiteStatus EvalHybridPerChannel(TfLiteContext* context, TfLiteNode* node,
TfLiteConvParams* params, OpData* data,
const TfLiteTensor* input,
const TfLiteTensor* filter,
const TfLiteT... | cwe | CWE-369 | C/C++ |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
auto* params =
reinterpret_cast<TfLiteLSHProjectionParams*>(node->builtin_data);
int32_t* out_buf = GetOutput(context, node, 0)->data.i32;
const TfLiteTensor* hash = GetInput(context, node, 0);
const TfLiteTensor* input = GetInput(context, nod... | cwe | CWE-787 | C/C++ |
static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
BMPInfo
bmp_info;
Image
*image;
MagickBooleanType
status;
MagickOffsetType
offset,
start_position;
MemoryInfo
*pixel_info;
Quantum
index;
register Quantum
*q;
register ssize_t
i,... | cwe | CWE-835 | Unknown |
/*
* Copyright © 2015-2018 Aeneas Rekkas <aeneas+oss@aeneas.io>
*
* 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... | cwe | CWE-755 | Go |
/*
* Licensed to GraphHopper GmbH under one or more contributor
* license agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*
* GraphHopper GmbH licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not ... | cwe | CWE-400 | Java |
static void ahash_op_unaligned_done(struct crypto_async_request *req, int err)
{
struct ahash_request *areq = req->data;
/*
* Restore the original request, see ahash_op_unaligned() for what
* goes where.
*
* The "struct ahash_request *req" here is in fact the "req.base"
* from the ADJUSTED request from aha... | cwe | CWE-835 | Unknown |
int jpc_ppxstab_insert(jpc_ppxstab_t *tab, jpc_ppxstabent_t *ent)
{
int inspt;
int i;
for (i = 0; i < tab->numents; ++i) {
if (tab->ents[i]->ind > ent->ind) {
break;
}
}
inspt = i;
if (tab->numents >= tab->maxents) {
if (jpc_ppxstab_grow(tab, tab->maxents + 128)) {
return -1;
}
}
for (i = tab->... | cwe | CWE-787 | C/C++ |
public JWECryptoParts encrypt(final JWEHeader header, final byte[] clearText)
throws JOSEException {
final JWEAlgorithm alg = header.getAlgorithm();
// Check the AES key size and determine the algorithm family
final AlgFamily algFamily;
if (alg.equals(JWEAlgorithm.A128KW)) {
if(ByteUtils.bitLength(getK... | cwe | CWE-345 | Java |
AlgorithmEnum* ZRtp::findBestSASType(ZrtpPacketHello *hello) {
int i;
int ii;
int numAlgosOffered;
AlgorithmEnum* algosOffered[ZrtpConfigure::maxNoOfAlgos+1];
int numAlgosConf;
AlgorithmEnum* algosConf[ZrtpConfigure::maxNoOfAlgos+1];
int num = hello->getNumSas();
if (num == 0) {
... | cwe | CWE-119 | Unknown |
/*
* 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++ |
#!/usr/bin/python -u
#
# p7zr library
#
# Copyright (c) 2019-2021 Hiroshi Miura <miurahr@linux.com>
# Copyright (c) 2004-2015 by Joachim Bauch, mail@joachim-bauch.de
#
# 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 t... | cwe | CWE-22 | Python |
f_py3eval(typval_T *argvars, typval_T *rettv)
{
char_u *str;
char_u buf[NUMBUFLEN];
if (p_pyx == 0)
p_pyx = 3;
str = tv_get_string_buf(&argvars[0], buf);
do_py3eval(str, rettv);
} | cwe | CWE-78 | Unknown |
static int snd_seq_ioctl_create_port(struct snd_seq_client *client, void *arg)
{
struct snd_seq_port_info *info = arg;
struct snd_seq_client_port *port;
struct snd_seq_port_callback *callback;
/* it is not allowed to create the port for an another client */
if (info->addr.client != client->number)
return ... | cwe | CWE-416 | C/C++ |
EAS_RESULT DLSParser (EAS_HW_DATA_HANDLE hwInstData, EAS_FILE_HANDLE fileHandle, EAS_I32 offset, EAS_DLSLIB_HANDLE *ppDLS)
{
EAS_RESULT result;
SDLS_SYNTHESIZER_DATA dls;
EAS_U32 temp;
EAS_I32 pos;
EAS_I32 chunkPos;
EAS_I32 size;
EAS_I32 instSize;
EAS_I32 rgnPoolSize;
EAS_I32 artPool... | cwe | CWE-284 | C/C++ |
'use strict';
var util = require('util'),
path = require('path'),
shell = require('shelljs'),
debug = require('debug')('dns-sync');
//source - http://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address
var ValidHostnameRegex = new RegExp("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-... | cwe | CWE-77 | JavaScript |
int PipeSocketHandler::connect(const SocketEndpoint& endpoint) {
lock_guard<std::recursive_mutex> mutexGuard(globalMutex);
string pipePath = endpoint.name();
sockaddr_un remote;
int sockFd = ::socket(AF_UNIX, SOCK_STREAM, 0);
FATAL_FAIL(sockFd);
initSocket(sockFd);
remote.sun_family = AF_UNIX;
strcpy(... | cwe | CWE-362 | C/C++ |
/* pb_encode.c -- encode a protobuf using minimal resources
*
* 2011 Petteri Aimonen <jpa@kapsi.fi>
*/
#include "pb.h"
#include "pb_encode.h"
#include "pb_common.h"
/* Use the GCC warn_unused_result attribute to check that all return values
* are propagated correctly. On other compilers and gcc before 3.4.0 just
... | cwe | CWE-787 | C/C++ |
static int irda_getname(struct socket *sock, struct sockaddr *uaddr,
int *uaddr_len, int peer)
{
struct sockaddr_irda saddr;
struct sock *sk = sock->sk;
struct irda_sock *self = irda_sk(sk);
if (peer) {
if (sk->sk_state != TCP_ESTABLISHED)
return -ENOTCONN;
saddr.sir_family = AF_IRDA;
saddr.sir_lsap_s... | cwe | CWE-200 | Unknown |
void user_describe(const struct key *key, struct seq_file *m)
{
seq_puts(m, key->description);
if (key_is_instantiated(key))
seq_printf(m, ": %u", key->datalen);
} | cwe | CWE-20 | C/C++ |
static void arc_emac_tx_clean(struct net_device *ndev)
{
struct arc_emac_priv *priv = netdev_priv(ndev);
struct net_device_stats *stats = &ndev->stats;
unsigned int i;
for (i = 0; i < TX_BD_NUM; i++) {
unsigned int *txbd_dirty = &priv->txbd_dirty;
struct arc_emac_bd *txbd = &priv->txbd[*txbd_dirty];
struct b... | cwe | CWE-362 | C/C++ |
def move(path, dest, replace=False):
"""Rename a file. `dest` may not be a directory. If `dest` already
exists, raises an OSError unless `replace` is True. Has no effect if
`path` is the same as `dest`. If the paths are on different
filesystems (or the rename otherwise fails), a copy is attempted
in... | cwe | CWE-377 | Python |
# -*- coding: utf-8 -*-
# See https://zulip.readthedocs.io/en/latest/subsystems/thumbnailing.html
import base64
import os
import sys
import urllib
from django.conf import settings
from libthumbor import CryptoURL
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath('__file__'))))
sys.path.appen... | cwe | CWE-601 | Python |
static void clear_evtchn_to_irq_row(unsigned row)
{
unsigned col;
for (col = 0; col < EVTCHN_PER_ROW; col++)
evtchn_to_irq[row][col] = -1;
} | cwe | CWE-476 | C/C++ |
void ntlm_free_message_fields_buffer(NTLM_MESSAGE_FIELDS* fields)
{
if (fields)
{
if (fields->Buffer)
{
free(fields->Buffer);
fields->Len = 0;
fields->MaxLen = 0;
fields->Buffer = NULL;
fields->BufferOffset = 0;
}
}
} | cwe | CWE-125 | C/C++ |
amstar_selfcheck(
application_argument_t *argument)
{
if (argument->dle.disk) {
char *qdisk = quote_string(argument->dle.disk);
fprintf(stdout, "OK disk %s\n", qdisk);
amfree(qdisk);
}
fprintf(stdout, "OK amstar version %s\n", VERSION);
fprintf(stdout, "OK amstar\n");
if (argument->dle.devi... | cwe | CWE-77 | Unknown |
setup_connection (GsmXSMPClient *client)
{
GIOChannel *channel;
int fd;
g_debug ("GsmXSMPClient: Setting up new connection");
fd = IceConnectionNumber (client->priv->ice_connection);
fcntl (fd, F_SETFD, fcntl (fd, F_GETFD, 0) | FD_CLOEXEC);
channel = g_io_... | cwe | CWE-835 | C/C++ |
void SoftAAC2::onQueueFilled(OMX_U32 /* portIndex */) {
if (mSignalledError || mOutputPortSettingsChange != NONE) {
return;
}
UCHAR* inBuffer[FILEREAD_MAX_LAYERS];
UINT inBufferLength[FILEREAD_MAX_LAYERS] = {0};
UINT bytesValid[FILEREAD_MAX_LAYERS] = {0};
List<BufferInfo *> &inQueue = getPortQueue(0);... | cwe | CWE-20 | Unknown |
static int do_change_type(struct nameidata *nd, int flag)
{
struct vfsmount *m, *mnt = nd->mnt;
int recurse = flag & MS_REC;
int type = flag & ~MS_REC;
if (nd->dentry != nd->mnt->mnt_root)
return -EINVAL;
down_write(&namespace_sem);
spin_lock(&vfsmount_lock);
for (m = mnt; m; m = (recurse ? next_mnt(m, mnt) ... | cwe | CWE-269 | Unknown |
add_mtab(char *devname, char *mountpoint, unsigned long flags, const char *fstype)
{
int rc = 0;
uid_t uid;
char *mount_user = NULL;
struct mntent mountent;
FILE *pmntfile;
sigset_t mask, oldmask;
uid = getuid();
if (uid != 0)
mount_user = getusername(uid);
/*
* Set the real uid to the effective uid. Thi... | cwe | CWE-20 | C/C++ |
backsql_process_filter_attr( backsql_srch_info *bsi, Filter *f, backsql_at_map_rec *at )
{
backsql_info *bi = (backsql_info *)bsi->bsi_op->o_bd->be_private;
int casefold = 0;
struct berval *filter_value = NULL;
MatchingRule *matching_rule = NULL;
struct berval ordering = BER_BVC("<=");
Debug( LDAP_DEBUG_TR... | cwe | CWE-89 | Unknown |
function main()
{
if (window.parent != null && window.parent.Editor != null)
{
if (window.parent.Editor.useLocalStorage)
{
document.body.innerHTML = '';
var div = document.createElement('div');
div.style.fontFamily = 'Arial';
var darkMode = typeof window.parent.Editor.isDarkMode === 'function' &&
... | cwe | CWE-94 | JavaScript |
txid_current_snapshot(PG_FUNCTION_ARGS)
{
TxidSnapshot *snap;
uint32 nxip,
i,
size;
TxidEpoch state;
Snapshot cur;
cur = GetActiveSnapshot();
if (cur == NULL)
elog(ERROR, "no active snapshot set");
load_xid_epoch(&state);
/* allocate */
nxip = cur->xcnt;
size = TXID_SNAPSHOT_SIZE(nxip);
s... | cwe | CWE-189 | C/C++ |
/* nautilus-metadata.c - metadata utils
*
* Copyright (C) 2009 Red Hatl, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your opti... | cwe | CWE-20 | C/C++ |
static int __ip_append_data(struct sock *sk,
struct flowi4 *fl4,
struct sk_buff_head *queue,
struct inet_cork *cork,
struct page_frag *pfrag,
int getfrag(void *from, char *to, int offset,
int len, int odd, struct sk_buff *skb),
void *from, int length, int transhdrlen,
... | cwe | CWE-362 | C/C++ |
function escapeShellArg(arg) {
return arg.replace(/'/g, `'\\''`);
} | cwe | CWE-88 | JavaScript |
static apr_status_t modsecurity_request_body_store_memory(modsec_rec *msr,
const char *data, apr_size_t length, char **error_msg)
{
*error_msg = NULL;
/* Would storing this chunk mean going over the limit? */
if ((msr->msc_reqbody_spilltodisk)
&& (msr->msc_reqbody_length + length > (apr_size_t)... | cwe | CWE-476 | C/C++ |
public InputStream getResourceAsStream(String path) throws IOException {
return classLoader.getResourceAsStream(THEME_RESOURCES_RESOURCES + path);
} | cwe | CWE-22 | Java |
# -*- coding: utf-8 -*-
from django.utils import timezone
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib import messages
from django.utils.translation import gettext as _
from spirit.core.utils.views import is_post
from spirit.core.utils.decorators import moderator_required
from ... | cwe | CWE-601 | Python |
int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,
bool exact_size)
{
BDRVQcowState *s = bs->opaque;
int new_l1_size2, ret, i;
uint64_t *new_l1_table;
int64_t old_l1_table_offset, old_l1_size;
int64_t new_l1_table_offset, new_l1_size;
uint8_t data[12];
... | cwe | CWE-190 | C/C++ |
ast_for_comprehension(struct compiling *c, const node *n)
{
int i, n_fors;
asdl_seq *comps;
n_fors = count_comp_fors(c, n);
if (n_fors == -1)
return NULL;
comps = _Ta3_asdl_seq_new(n_fors, c->c_arena);
if (!comps)
return NULL;
for (i = 0; i < n_fors; i++) {
compreh... | cwe | CWE-125 | C/C++ |
gdm_session_worker_open_session (GdmSessionWorker *worker,
GError **error)
{
int error_code;
int flags;
char *session_id = NULL;
g_assert (worker->priv->state == GDM_SESSION_WORKER_STATE_ACCOUNT_DETAILS_SAVED);
g_assert (geteuid () == ... | cwe | CWE-362 | Unknown |
parsecolorchar(zattr arg, int is_fg)
{
if (bv->fm[1] == '{') {
char *ep;
bv->fm += 2; /* skip over F{ */
if ((ep = strchr(bv->fm, '}'))) {
char oc = *ep, *col, *coll;
*ep = '\0';
/* expand the contents of the argument so you can use
* %v for example */
coll = col = promptexpand(bv->fm, ... | cwe | CWE-476 | Unknown |
*/
static int wddx_stack_destroy(wddx_stack *stack)
{
register int i;
if (stack->elements) {
for (i = 0; i < stack->top; i++) {
if (((st_entry *)stack->elements[i])->data) {
zval_ptr_dtor(&((st_entry *)stack->elements[i])->data);
}
if (((st_entry *)stack->elements[i])->varname) {
efree(((st_entry ... | cwe | CWE-416 | C/C++ |
function initialize() {
destroy();
if (! window.Clipboard) {
// Insert the content editable at the top to avoid scrolling down in the board view
pasteCatcher = document.createElement('div');
pasteCatcher.id = 'screenshot-pastezone';
pasteCatcher.contentEd... | cwe | CWE-79 | JavaScript |
static int l2tp_ip6_getname(struct socket *sock, struct sockaddr *uaddr,
int *uaddr_len, int peer)
{
struct sockaddr_l2tpip6 *lsa = (struct sockaddr_l2tpip6 *)uaddr;
struct sock *sk = sock->sk;
struct ipv6_pinfo *np = inet6_sk(sk);
struct l2tp_ip6_sock *lsk = l2tp_ip6_sk(sk);
lsa->l2tp_family = AF_INET6;
... | cwe | CWE-200 | C/C++ |
# Generated by Django 3.0.7 on 2021-01-03 12:13
import InvenTree.fields
import InvenTree.validators
from django.db import migrations, models
import django.db.models.deletion
import markdownx.models
import mptt.fields
import part.settings
class Migration(migrations.Migration):
dependencies = [
('stock', ... | cwe | CWE-400 | Python |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
auto* params = reinterpret_cast<TfLiteMfccParams*>(node->user_data);
const TfLiteTensor* input_wav = GetInput(context, node, kInputTensorWav);
const TfLiteTensor* input_rate = GetInput(context, node, kInputTensorRate);
TfLiteTensor* output = GetOutp... | cwe | CWE-787 | C/C++ |
readSampleCountForLineBlock(InputStreamMutex* streamData,
DeepScanLineInputFile::Data* data,
int lineBlockId)
{
streamData->is->seekg(data->lineOffsets[lineBlockId]);
if (isMultiPart(data->version))
{
int partNumber;
OPENEXR_IMF_INTERN... | cwe | CWE-787 | C/C++ |
def load_hparams_from_yaml(config_yaml: str, use_omegaconf: bool = True) -> Dict[str, Any]:
"""Load hparams from a file.
Args:
config_yaml: Path to config yaml file
use_omegaconf: If omegaconf is available and ``use_omegaconf=True``,
the hparams will be converted to ... | cwe | CWE-502 | Python |
static ssize_t _hostfs_writev(
oe_fd_t* desc,
const struct oe_iovec* iov,
int iovcnt)
{
ssize_t ret = -1;
file_t* file = _cast_file(desc);
void* buf = NULL;
size_t buf_size = 0;
if (!file || !iov || iovcnt < 0 || iovcnt > OE_IOV_MAX)
OE_RAISE_ERRNO(OE_EINVAL);
/* Flatten th... | cwe | CWE-552 | Unknown |
package collection
import (
"context"
"github.com/answerdev/answer/internal/base/constant"
"github.com/answerdev/answer/internal/base/data"
"github.com/answerdev/answer/internal/base/pager"
"github.com/answerdev/answer/internal/base/reason"
"github.com/answerdev/answer/internal/entity"
collectioncommon "github... | cwe | CWE-362 | Go |
package cmd
import (
"fmt"
"log"
"os"
"strings"
"github.com/dutchcoders/transfer.sh/server"
"github.com/fatih/color"
"github.com/urfave/cli"
"google.golang.org/api/googleapi"
)
var Version = "1.2.2"
var helpTemplate = `NAME:
{{.Name}} - {{.Usage}}
DESCRIPTION:
{{.Description}}
USAGE:
{{.Name}} {{if .Flags}... | cwe | CWE-79 | Go |
bool IsPadOpSupported(const TfLiteRegistration* registration,
const TfLiteNode* node, TfLiteContext* context) {
// padding is d x 2 tensor, where d is the dimension of input.
const TfLiteTensor* padding = GetInput(context, node, 1);
if (!IsConstantTensor(padding)) {
TF_LITE_KERNEL_LOG(co... | cwe | CWE-125 | C/C++ |
kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
{
if (args->flags & ~(KVM_IRQFD_FLAG_DEASSIGN | KVM_IRQFD_FLAG_RESAMPLE))
return -EINVAL;
if (args->flags & KVM_IRQFD_FLAG_DEASSIGN)
return kvm_irqfd_deassign(kvm, args);
return kvm_irqfd_assign(kvm, args);
} | cwe | CWE-20 | C/C++ |
package client
import (
"encoding/json"
"fmt"
api "k8s.io/api/core/v1"
"github.com/kubeedge/beehive/pkg/core/model"
"github.com/kubeedge/kubeedge/edge/pkg/common/message"
"github.com/kubeedge/kubeedge/edge/pkg/common/modules"
"github.com/kubeedge/kubeedge/edge/pkg/metamanager"
)
//NodesGetter to get node int... | cwe | CWE-476 | Go |
int vrend_renderer_resource_create(struct vrend_renderer_resource_create_args *args, struct iovec *iov, uint32_t num_iovs, void *image_oes)
{
struct vrend_resource *gr;
int ret;
ret = check_resource_valid(args);
if (ret)
return EINVAL;
gr = (struct vrend_resource *)CALLOC_STRUCT(vrend_texture);
... | cwe | CWE-476 | Unknown |
static bool r_bin_mdmp_init_directory(struct r_bin_mdmp_obj *obj) {
int i;
ut8 *directory_base;
struct minidump_directory *entry;
directory_base = obj->b->buf + obj->hdr->stream_directory_rva;
sdb_num_set (obj->kv, "mdmp_directory.offset",
obj->hdr->stream_directory_rva, 0);
sdb_set (obj->kv, "mdmp_directory... | cwe | CWE-125 | C/C++ |
void ZRtp::storeMsgTemp(ZrtpPacketBase* pkt) {
int32_t length = pkt->getLength() * ZRTP_WORD_SIZE;
memset(tempMsgBuffer, 0, sizeof(tempMsgBuffer));
memcpy(tempMsgBuffer, (uint8_t*)pkt->getHeaderBase(), length);
lengthOfMsgData = length;
} | cwe | CWE-119 | C/C++ |
void operator()(OpKernelContext* ctx, const CPUDevice& d, int64 num_batches,
int64 samples_per_batch, int64 num_elements,
typename TTypes<T>::ConstFlat means,
typename TTypes<T>::ConstFlat stddevs,
typename TTypes<T>::ConstFlat minvals,
... | cwe | CWE-197 | C/C++ |
static void perf_event_init_cpu(int cpu)
{
struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu);
mutex_lock(&swhash->hlist_mutex);
swhash->online = true;
if (swhash->hlist_refcount > 0) {
struct swevent_hlist *hlist;
hlist = kzalloc_node(sizeof(*hlist), GFP_KERNEL, cpu_to_node(cpu));
WARN_ON(!hlist... | cwe | CWE-362 | Unknown |
# -*- coding: utf-8 -*-
from django.contrib import messages
from django.contrib.auth import views as django_views
from django.urls import reverse
from django.shortcuts import redirect, render, get_object_or_404
from django.utils.translation import gettext as _
from django.contrib.auth import get_user_model
from django... | cwe | CWE-601 | Python |
public void newDocumentWebHomeFromURLTemplateProviderSpecifiedButNotAllowed() throws Exception
{
// new document = xwiki:X.Y.WebHome
DocumentReference documentReference = new DocumentReference("xwiki", Arrays.asList("X", "Y"), "WebHome");
XWikiDocument document = mock(XWikiDocument.class);
... | cwe | CWE-862 | Java |
passdb_preinit(pool_t pool, const struct auth_passdb_settings *set)
{
static unsigned int auth_passdb_id = 0;
struct passdb_module_interface *iface;
struct passdb_module *passdb;
unsigned int idx;
iface = passdb_interface_find(set->driver);
if (iface == NULL || iface->verify_plain == NULL) {
/* maybe it's a pl... | cwe | CWE-284 | Unknown |
int amqp_handle_input(amqp_connection_state_t state, amqp_bytes_t received_data,
amqp_frame_t *decoded_frame) {
size_t bytes_consumed;
void *raw_frame;
/* Returning frame_type of zero indicates either insufficient input,
or a complete, ignored frame was read. */
decoded_frame->frame_... | cwe | CWE-20 | C/C++ |
inline int check(int itemSize, int nItems=1)
{
if (ptr + itemSize * nItems > end) {
if (ptr + itemSize > end)
return overrun(itemSize, nItems);
nItems = (end - ptr) / itemSize;
}
return nItems;
} | cwe | CWE-122 | C/C++ |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
auto* params =
reinterpret_cast<TfLiteAudioSpectrogramParams*>(node->user_data);
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
TF_LITE_ENSURE(context, params... | cwe | CWE-125 | C/C++ |
static DataSource lookupDataSource(Hints hints) throws FactoryException {
Object hint = hints.get(Hints.EPSG_DATA_SOURCE);
if (hint instanceof DataSource) {
return (DataSource) hint;
} else if (hint instanceof String) {
String name = (String) hint;
InitialCont... | cwe | CWE-20 | Java |
TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
{
static const char module[] = "TIFFWriteDirectorySec";
uint32 ndir;
TIFFDirEntry* dir;
uint32 dirsize;
void* dirmem;
uint32 m;
if (tif->tif_mode == O_RDONLY)
return (1);
_TIFFFillStriles( tif );
/*
* Clear write... | cwe | CWE-617 | Unknown |
OMX_ERRORTYPE omx_venc::component_deinit(OMX_IN OMX_HANDLETYPE hComp)
{
(void) hComp;
OMX_U32 i = 0;
DEBUG_PRINT_HIGH("omx_venc(): Inside component_deinit()");
if (OMX_StateLoaded != m_state) {
DEBUG_PRINT_ERROR("WARNING:Rxd DeInit,OMX not in LOADED state %d",\
m_state);
}
if (... | cwe | CWE-119 | C/C++ |
/******************************************************************************/
/* */
/* X r d S e c g s i G M A P F u n L D A P . c c */
/* ... | cwe | CWE-78 | C/C++ |
bool WebSocketProtocol<isServer>::handleFragment(char *data, size_t length, unsigned int remainingBytes, int opCode, bool fin, void *user) {
uS::Socket s((uv_poll_t *) user);
typename WebSocket<isServer>::Data *webSocketData = (typename WebSocket<isServer>::Data *) s.getSocketData();
if (opCode < 3) {
... | cwe | CWE-20 | Unknown |
// Package impersonation sets up service accounts that are permitted to act on behalf of a Rancher user on a cluster.
package impersonation
import (
"fmt"
"reflect"
"sort"
"time"
authcommon "github.com/rancher/rancher/pkg/auth/providers/common"
v3 "github.com/rancher/rancher/pkg/generated/norman/management.catt... | cwe | CWE-331 | Go |
static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
struct nft_data_desc *desc, const struct nlattr *nla)
{
u8 genmask = nft_genmask_next(ctx->net);
struct nlattr *tb[NFTA_VERDICT_MAX + 1];
struct nft_chain *chain;
int err;
err = nla_parse_nested_deprecated(tb, NFTA_VERDICT_MAX, n... | cwe | CWE-703 | C/C++ |
ambsdtar_backup(
application_argument_t *argument)
{
int dumpin;
char *cmd = NULL;
char *qdisk;
char *timestamps;
int mesgf = 3;
int indexf = 4;
int outf;
int data_out;
int index_out;
int index_err;
char ... | cwe | CWE-264 | Unknown |
static cJSON *get_object_item(const cJSON * const object, const char * const name, const cJSON_bool case_sensitive)
{
cJSON *current_element = NULL;
if ((object == NULL) || (name == NULL))
{
return NULL;
}
current_element = object->child;
if (case_sensitive)
{
while ((curre... | cwe | CWE-476 | C/C++ |
video_usercopy(struct file *file, unsigned int orig_cmd, unsigned long arg,
v4l2_kioctl func)
{
char sbuf[128];
void *mbuf = NULL;
void *parg = (void *)arg;
long err = -EINVAL;
bool has_array_args;
bool always_copy = false;
size_t array_size = 0;
void __user *user_ptr = NULL;
void **kernel_ptr = N... | cwe | CWE-401 | C/C++ |
# -*- coding: utf-8 -*-
# rdiffweb, A web interface to rdiff-backup repositories
# Copyright (C) 2012-2021 rdiffweb contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version ... | cwe | CWE-306 | Python |
static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *str, size_t str_nbytes, const char *enc, const char **next_pos, int mode)
{
php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;
iconv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1);
const char *p1;
size_t str_left;
unsigned int scan_stat = 0;
c... | cwe | CWE-125 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.