code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
"""
Authenticated HTTP proxy for Jupyter Notebooks
Some original inspiration from https://github.com/senko/tornado-proxy
"""
import inspect
import socket
import os
from urllib.parse import urlunparse, urlparse, quote
import aiohttp
from asyncio import Lock
from copy import copy
from tornado import gen, web, httpclie... | cwe | CWE-918 | Python |
public function lostpasswordAction(Request $request, BruteforceProtectionHandler $bruteforceProtectionHandler)
{
$view = $this->buildLoginPageViewModel();
$view->success = false;
// TODO is the error on the view used somewhere?
if ($request->getMethod() === 'POST' && $username = $re... | cwe | CWE-307 | PHP |
/* 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-617 | Python |
/* This file is copied from the libsrs2 sources */
/* Modified by Timo Röhling <timo.roehling@gmx.de> */
/* Copyright (c) 2004 Shevek (srs@anarres.org)
* All rights reserved.
*
* This file is a part of libsrs2 from http://www.libsrs2.org/
*
* Redistribution and use in source and binary forms, with or without
* m... | cwe | CWE-834 | C/C++ |
static int test_x509_time(int idx)
{
ASN1_TIME *t = NULL;
int result, rv = 0;
if (x509_format_tests[idx].set_string) {
/* set-string mode */
t = ASN1_TIME_new();
if (t == NULL) {
TEST_info("test_x509_time(%d) failed: internal error\n", idx);
return 0;
... | cwe | CWE-125 | Unknown |
snmp_ber_encode_length(unsigned char *out, uint32_t *out_len, uint8_t length)
{
*out-- = length;
(*out_len)++;
return out;
} | cwe | CWE-125 | C/C++ |
nlmsvc_grant_reply(struct nlm_cookie *cookie, __be32 status)
{
struct nlm_block *block;
dprintk("grant_reply: looking for cookie %x, s=%d \n",
*(unsigned int *)(cookie->data), status);
if (!(block = nlmsvc_find_block(cookie)))
return;
if (block) {
if (status == nlm_lck_denied_grace_period) {
/* Try ag... | cwe | CWE-404 | C/C++ |
/*
Developed by ESN, an Electronic Arts Inc. studio.
Copyright (c) 2014, Electronic Arts 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 of source code must retain the above copyri... | cwe | CWE-415 | Python |
mark_source_chains(const struct xt_table_info *newinfo,
unsigned int valid_hooks, void *entry0)
{
unsigned int hook;
/* No recursion; use packet counter to save back ptrs (reset
to 0 as we leave), and comefrom to save source hook bitmask */
for (hook = 0; hook < NF_INET_NUMHOOKS; hook++) {
unsigned int p... | cwe | CWE-119 | C/C++ |
GF_Err trak_box_size(GF_Box *s)
{
u32 pos=0;
GF_TrackBox *ptr = (GF_TrackBox *)s;
if (ptr->sample_encryption && ptr->sample_encryption->load_needed) {
GF_Err e = senc_Parse(ptr->moov->mov->movieFileMap->bs, ptr, NULL, ptr->sample_encryption);
if (e) return e;
}
gf_isom_check_position(s, (GF_Box *)ptr->Header... | cwe | CWE-787 | C/C++ |
function updateLinkColor()
{
var div = document.createElement('div');
div.style.width = '100%';
div.style.height = '100%';
div.style.boxSizing = 'border-box';
if (linkColor != null && linkColor != mxConstants.NONE)
{
div.style.border = '1px solid black';
div.style.backgroundColor = linkColo... | cwe | CWE-94 | JavaScript |
static void jsiSqlFunc(sqlite3_context *context, int argc, sqlite3_value**argv) {
SqlFunc *p = (SqlFunc*)sqlite3_user_data(context);
int i;
int rc;
Jsi_Interp *interp = p->interp;
Jsi_Value *vpargs, *itemsStatic[100], **items = itemsStatic, *ret;
if (argc>100)
items = (Jsi_Value**)Jsi_Ca... | cwe | CWE-120 | C/C++ |
static pyc_object *get_object(RBuffer *buffer) {
bool error = false;
pyc_object *ret = NULL;
ut8 code = get_ut8 (buffer, &error);
ut8 flag = code & FLAG_REF;
RListIter *ref_idx = NULL;
ut8 type = code & ~FLAG_REF;
if (error) {
return NULL;
}
if (flag) {
ret = get_none_object ();
if (!ret) {
return N... | cwe | CWE-416 | C/C++ |
bool VaapiVideoDecodeAccelerator::VaapiVP8Accelerator::OutputPicture(
const scoped_refptr<VP8Picture>& pic) {
scoped_refptr<VaapiDecodeSurface> dec_surface =
VP8PictureToVaapiDecodeSurface(pic);
dec_surface->set_visible_rect(pic->visible_rect);
vaapi_dec_->SurfaceReady(dec_surface);
return true;
} | cwe | CWE-362 | C/C++ |
void svhandler_flash_erase_sector(void) {
uint32_t sector = _param_1;
// Do not allow firmware to erase bootstrap or bootloader sectors.
if ((sector == FLASH_BOOTSTRAP_SECTOR) ||
(sector >= FLASH_BOOT_SECTOR_FIRST && sector <= FLASH_BOOT_SECTOR_LAST)) {
return;
}
// Unlock flash.
flash_clear_sta... | cwe | CWE-125 | Unknown |
static int sctp_process_param(struct sctp_association *asoc,
union sctp_params param,
const union sctp_addr *peer_addr,
gfp_t gfp)
{
struct net *net = sock_net(asoc->base.sk);
union sctp_addr addr;
int i;
__u16 sat;
int retval = 1;
sctp_scope_t scope;
time_t stale;
struct sctp_af *af;... | cwe | CWE-399 | C/C++ |
int
yyparse (void *scanner, struct yang_parameter *param)
{
/* The lookahead symbol. */
int yychar;
char *s = NULL, *tmp_s = NULL, *ext_name = NULL;
struct lys_module *trg = NULL;
struct lys_node *tpdf_parent = NULL, *data_node = NULL;
struct lys_ext_instance_complex *ext_instance = NULL;
int is_ext_instance;
void *ac... | cwe | CWE-415 | C/C++ |
func ParseMPLSLabelStack(buf string) (*MPLSLabelStack, error) {
elems := strings.Split(buf, "/")
labels := make([]uint32, 0, len(elems))
if len(elems) == 0 {
goto ERR
}
for _, elem := range elems {
i, err := strconv.Atoi(elem)
if err != nil {
goto ERR
}
if i < 0 || i > ((1<<20)-1) {
goto ERR
}
... | cwe | CWE-681 | Go |
uint8_t rfc_parse_data(tRFC_MCB* p_mcb, MX_FRAME* p_frame, BT_HDR* p_buf) {
uint8_t ead, eal, fcs;
uint8_t* p_data = (uint8_t*)(p_buf + 1) + p_buf->offset;
uint8_t* p_start = p_data;
uint16_t len;
if (p_buf->len < RFCOMM_CTRL_FRAME_LEN) {
RFCOMM_TRACE_ERROR("Bad Length1: %d", p_buf->len);
return (RFC_EVENT_B... | cwe | CWE-125 | Unknown |
def authenticates_with_sorcery!
@sorcery_config = Config.new
extend ClassMethods # included here, before submodules, so they can be overriden by them.
include InstanceMethods
include TemporaryToken
include_required_submodules!
# This runs the options block set in the initializer o... | cwe | CWE-307 | Ruby |
/* 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-754 | C/C++ |
/**
* XmlHttpRequest implementation that uses TLS and flash SocketPool.
*
* @author Dave Longley
*
* Copyright (c) 2010-2013 Digital Bazaar, Inc.
*/
var forge = require('./forge');
require('./socket');
require('./http');
/* XHR API */
var xhrApi = module.exports = forge.xhr = forge.xhr || {};
(function($) {
//... | cwe | CWE-601 | JavaScript |
xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){
static char base_address;
xmlNodePtr cur = NULL;
xmlXPathObjectPtr obj = NULL;
long val;
xmlChar str[30];
xmlDocPtr doc;
if (nargs == 0) {
cur = ctxt->context->node;
} else if (nargs == 1) {
xmlNodeSetPtr nodelist... | cwe | CWE-119 | C/C++ |
isakmp_rfc3948_print(netdissect_options *ndo,
const u_char *bp, u_int length,
const u_char *bp2)
{
if(length == 1 && bp[0]==0xff) {
ND_PRINT((ndo, "isakmp-nat-keep-alive"));
return;
}
if(length < 4) {
goto trunc;
}
/*
* see if this is an IKE packet
*/
if(bp[0]==0 && bp[1]==0 && bp[2]==0... | cwe | CWE-125 | C/C++ |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may n... | cwe | CWE-502 | Java |
static void sycc422_to_rgb(opj_image_t *img)
{
int *d0, *d1, *d2, *r, *g, *b;
const int *y, *cb, *cr;
unsigned int maxw, maxh, max;
int offset, upb;
unsigned int i, j;
upb = (int)img->comps[0].prec;
offset = 1<<(upb - 1); upb = (1<<upb)-1;
maxw = (unsigned int)img->comps[0].w; maxh = (unsigned int)img->comps... | cwe | CWE-125 | C/C++ |
_rsa_blind (const struct rsa_public_key *pub,
void *random_ctx, nettle_random_func *random,
mpz_t c, mpz_t ri)
{
mpz_t r;
mpz_init(r);
/* c = c*(r^e)
* ri = r^(-1)
*/
do
{
nettle_mpz_random(r, random_ctx, random, pub->n);
/* invert r */
}
while (!mpz_invert (ri, r, pub->... | cwe | CWE-203 | Unknown |
Status ConvBackpropComputeDimensionsV2(
StringPiece label, int num_spatial_dims, const TensorShape& input_shape,
const TensorShape& filter_shape, const TensorShape& out_backprop_shape,
const gtl::ArraySlice<int32>& dilations, const std::vector<int32>& strides,
Padding padding, absl::Span<const int64> ex... | cwe | CWE-369 | C/C++ |
ubik_print(netdissect_options *ndo,
register const u_char *bp)
{
int ubik_op;
int32_t temp;
/*
* Print out the afs call we're invoking. The table used here was
* gleaned from ubik/ubik_int.xg
*/
ubik_op = EXTRACT_32BITS(bp + sizeof(struct rx_header));
ND_PRINT((ndo, " ubik call %s", tok2str(ub... | cwe | CWE-125 | C/C++ |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may n... | cwe | CWE-668 | Java |
def close(self):
self.lock.release() | cwe | CWE-264 | Python |
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-703 | C/C++ |
function B(ia,ra,aa,ca,na){na||(ea.innerHTML="",M(),S=ia,Y=ca);var la=null;if(aa){la=document.createElement("table");
la.className="geTempDlgDiagramsListGrid";var qa=document.createElement("tr"),ta=document.createElement("th");ta.style.width="50%";ta.innerHTML=mxUtils.htmlEntities(mxResources.get("diagram"));qa.appendC... | cwe | CWE-94 | JavaScript |
ambsdtar_estimate(
application_argument_t *argument)
{
char *incrname = NULL;
GPtrArray *argv_ptr;
char *cmd = NULL;
int nullfd = -1;
int pipefd = -1;
FILE *dumpout = NULL;
off_t size = -1;
char line[32768];
char *errmsg = NULL;
ch... | cwe | CWE-264 | Unknown |
static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
{
bool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG;
u32 chunk_size = mr->chunk_size, headroom = mr->headroom;
unsigned int chunks, chunks_per_page;
u64 addr = mr->addr, size = mr->len;
int size_chk, err;
if (chunk_size < XDP... | cwe | CWE-416 | C/C++ |
PHP_FUNCTION(imageconvolution)
{
zval *SIM, *hash_matrix;
zval **var = NULL, **var2 = NULL;
gdImagePtr im_src = NULL;
double div, offset;
int nelem, i, j, res;
float matrix[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}};
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "radd", &SIM, &hash_matrix, &div, &offset) == FAI... | cwe | CWE-189 | Unknown |
public static String getAttachedFilePath(String inputStudyOid) {
// Using a standard library to validate/Sanitize user inputs which will be used in path expression to prevent from path traversal
String studyOid = FilenameUtils.getName(inputStudyOid);
String attachedFilePath = CoreResources.getField("... | cwe | CWE-22 | Java |
package session
import (
"context"
"errors"
"fmt"
"net"
"net/http"
"os"
"time"
"github.com/argoproj/argo-cd/server/rbacpolicy"
"github.com/dgrijalva/jwt-go"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/argoproj/argo-cd/common"
"github.com/... | cwe | CWE-200 | Go |
/*
* Copyright (c) 2011-2020 Meltytech, LLC
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program i... | cwe | CWE-327 | C/C++ |
/**
*
* Rhonabwy JSON Web Encryption (JWE) library
*
* jwe.c: functions definitions
*
* Copyright 2020-2022 Nicolas Mora <mail@babelouest.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Softw... | cwe | CWE-120 | C/C++ |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
int num_inputs = NumInputs(node);
TF_LITE_ENSURE(context, num_inputs >= 2);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1);
TfLiteTensor* output = GetOutput(context, node, kO... | cwe | CWE-787 | C/C++ |
/*
* "Real" compatible demuxer.
* Copyright (c) 2000, 2001 Fabrice Bellard
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of th... | cwe | CWE-834 | C/C++ |
package com.salesmanager.shop.admin.controller.shipping;
import com.salesmanager.core.business.services.shipping.ShippingService;
import com.salesmanager.core.model.merchant.MerchantStore;
import com.salesmanager.core.model.system.IntegrationConfiguration;
import com.salesmanager.core.model.system.IntegrationModule;
i... | cwe | CWE-79 | Java |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-787 | C/C++ |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-416 | C/C++ |
static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h)
{
int i;
VncDisplay *vd = ds->opaque;
struct VncSurface *s = &vd->guest;
h += y;
/* round x down to ensure the loop only spans one 16-pixel block per,
iteration. otherwise, if (x % 16) != 0, the last iteration may spa... | cwe | CWE-125 | Unknown |
ScopedSharedBufferHandle WrapSharedMemoryHandle(
const base::SharedMemoryHandle& memory_handle,
size_t size,
bool read_only) {
if (!memory_handle.IsValid())
return ScopedSharedBufferHandle();
MojoPlatformHandle platform_handle;
platform_handle.struct_size = sizeof(MojoPlatformHandle);
platf... | cwe | CWE-787 | C/C++ |
it "activates user invited via email with a token" do
invite = Fabricate(:invite, invited_by: Fabricate(:admin), email: 'walter.white@email.com', emailed_status: Invite.emailed_status_types[:sent])
user = InviteRedeemer.create_user_from_invite(invite: invite, email: invite.email, username: 'walter', name: '... | cwe | CWE-285 | Ruby |
void ExtensionTtsController::ClearUtteranceQueue() {
while (!utterance_queue_.empty()) {
Utterance* utterance = utterance_queue_.front();
utterance_queue_.pop();
utterance->set_error(kSpeechRemovedFromQueueError);
utterance->FinishAndDestroy();
}
} | cwe | CWE-20 | C/C++ |
items: function (schema, candidate, callback) {
if (typeof callback === 'function') {
return this.asyncItems(schema, candidate, callback);
}
if (!(schema.items instanceof Object) || !(candidate instanceof Object)) {
return;
}
var items = schema.items;
var i, l;
// If provided schema is an a... | cwe | CWE-668 | JavaScript |
webSocketsDecodeHybi(rfbClientPtr cl, char *dst, int len)
{
char *buf, *payload;
uint32_t *payload32;
int ret = -1, result = -1;
int total = 0;
ws_mask_t mask;
ws_header_t *header;
int i;
unsigned char opcode;
ws_ctx_t *wsctx = (ws_ctx_t *)cl->wsctx;
int flength, fhlen;
/* in... | cwe | CWE-787 | C/C++ |
int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
{
struct page *page;
struct kvm *kvm;
int r;
BUG_ON(vcpu->kvm == NULL);
kvm = vcpu->kvm;
vcpu->arch.emulate_ctxt.ops = &emulate_ops;
if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_bsp(vcpu))
vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
else
vcpu->arch.mp_state = K... | cwe | CWE-399 | Unknown |
int X509_verify_cert(X509_STORE_CTX *ctx)
{
X509 *x, *xtmp, *xtmp2, *chain_ss = NULL;
int bad_chain = 0;
X509_VERIFY_PARAM *param = ctx->param;
int depth, i, ok = 0;
int num, j, retry;
int (*cb) (int xok, X509_STORE_CTX *xctx);
STACK_OF(X509) *sktmp = NULL;
if (ctx->cert == NULL) {
... | cwe | CWE-254 | Unknown |
#ifndef IGNOREALL
/*
dcraw.c -- Dave Coffin's raw photo decoder
Copyright 1997-2015 by Dave Coffin, dcoffin a cybercom o net
This is a command-line ANSI C program to convert raw photos from
any digital camera on any computer running any operating system.
No license is required to download and use dcraw... | cwe | CWE-119 | C/C++ |
static int ng_pkt(git_pkt **out, const char *line, size_t len)
{
git_pkt_ng *pkt;
const char *ptr;
size_t alloclen;
pkt = git__malloc(sizeof(*pkt));
GITERR_CHECK_ALLOC(pkt);
pkt->ref = NULL;
pkt->type = GIT_PKT_NG;
line += 3; /* skip "ng " */
if (!(ptr = strchr(line, ' ')))
goto out_err;
len = ptr ... | cwe | CWE-125 | C/C++ |
# WSGI interface for Roundup Issue Tracker
#
# This module is free software, you may redistribute it
# and/or modify under the same terms as Python.
#
import os
import cgi
import weakref
import roundup.instance
from roundup.cgi import TranslationService
from roundup.anypy import http_
from roundup.anypy.strings impor... | cwe | CWE-79 | Python |
public Cipher encrypt() {
try {
Cipher cipher = Secret.getCipher(ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, getKey());
return cipher;
} catch (GeneralSecurityException e) {
throw new AssertionError(e);
}
} | cwe | CWE-326 | Java |
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "responsestats.hh"
#include <limits>
#include "namespaces.hh"
#include "logger.hh"
#include "dnsparser.hh"
static auto sizeBounds()
{
std::vector<uint64_t> bounds;
bounds.push_back(20);
bounds.push_back(40);
bounds.push_back(60);
bounds.push_back(80)... | cwe | CWE-119 | C/C++ |
s32 gf_media_avc_read_sps(const char *sps_data, u32 sps_size, AVCState *avc, u32 subseq_sps, u32 *vui_flag_pos)
{
AVC_SPS *sps;
u32 ChromaArrayType = 0;
s32 mb_width, mb_height, sps_id = -1;
u32 profile_idc, level_idc, pcomp, i, chroma_format_idc, cl=0, cr=0, ct=0, cb=0, luma_bd, chroma_bd;
u8 separate_colour_plan... | cwe | CWE-787 | Unknown |
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Common library for ADIS16XXX devices
*
* Copyright 2012 Analog Devices Inc.
* Author: Lars-Peter Clausen <lars@metafoo.de>
*/
#include <linux/export.h>
#include <linux/interrupt.h>
#include <linux/mutex.h>
#include <linux/kernel.h>
#include <linux/spi/spi.h>
#in... | cwe | CWE-400 | C/C++ |
static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t len, int flags)
{
struct sock *sk = sock->sk;
struct sco_pinfo *pi = sco_pi(sk);
lock_sock(sk);
if (sk->sk_state == BT_CONNECT2 &&
test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) {
sco_conn_defer_accept(p... | cwe | CWE-269 | Unknown |
int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
rpmpsm psm, char ** failedFile)
{
FD_t payload = rpmtePayload(te);
rpmfi fi = NULL;
rpmfs fs = rpmteGetFileStates(te);
rpmPlugins plugins = rpmtsPlugins(ts);
int rc = 0;
int fx = -1;
int fc = rpmfilesFC(files);
... | cwe | CWE-59 | C/C++ |
/* Copyright 2017 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-120 | Python |
smb_send_kvec(struct TCP_Server_Info *server, struct kvec *iov, size_t n_vec,
size_t *sent)
{
int rc = 0;
int i = 0;
struct msghdr smb_msg;
unsigned int remaining;
size_t first_vec = 0;
struct socket *ssocket = server->ssocket;
*sent = 0;
if (ssocket == NULL)
return -ENOTSOCK; /* BB eventually add reconne... | cwe | CWE-362 | Unknown |
static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,
struct sk_buff_head *xmitq)
{
struct tipc_msg *hdr = buf_msg(skb);
struct tipc_gap_ack_blks *ga = NULL;
bool reply = msg_probe(hdr), retransmitted = false;
u16 dlen = msg_data_sz(hdr), glen = 0;
u16 peers_snd_nxt = msg_next_sent(hd... | cwe | CWE-787 | Unknown |
# -*- test-case-name: twisted.web.test.test_distrib -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Distributed web servers.
This is going to have to be refactored so that argument parsing is done
by each subprocess and not by the main web server (i.e. GET, POST etc.).
"""
import copy... | cwe | CWE-79 | Python |
def self.exists_copies_folder?(user_id)
my_folder = User.get_my_folder(user_id)
unless my_folder.nil?
con = "(parent_id=#{my_folder.id}) and (name='#{Item.copies_folder}')"
begin
copies_folder = Folder.where(con).first
rescue
end
end
return !copies_folder.nil?
end | cwe | CWE-89 | Ruby |
void Image::printIFDStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStructureOption option,uint32_t start,bool bSwap,char c,int depth)
{
depth++;
bool bFirst = true ;
// buffer
const size_t dirSize = 32;
DataBuf dir(dirSize);
bool bPrint = option == kpsBasic... | cwe | CWE-125 | C/C++ |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Netius System
# Copyright (c) 2008-2020 Hive Solutions Lda.
#
# This file is part of Hive Netius System.
#
# Hive Netius System is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apache
# Foundation, ei... | cwe | CWE-444 | Python |
int fpm_request_is_idle(struct fpm_child_s *child) /* {{{ */
{
struct fpm_scoreboard_proc_s *proc;
/* no need in atomicity here */
proc = fpm_scoreboard_proc_get(child->wp->scoreboard, child->scoreboard_i);
if (!proc) {
return 0;
}
return proc->request_stage == FPM_REQUEST_ACCEPTING;
} | cwe | CWE-787 | Unknown |
def add_input(self,data):
connection = self.connect()
try:
# The following is a flaw
query = "INSERT INTO crimes(description) VALUES ('{}');".format(data)
with connection.cursor() as cursor:
cursor.execute(query)
connection.commit()
... | cwe | CWE-89 | Python |
static int pop_fetch_message (CONTEXT* ctx, MESSAGE* msg, int msgno)
{
int ret;
void *uidl;
char buf[LONG_STRING];
char path[_POSIX_PATH_MAX];
progress_t progressbar;
POP_DATA *pop_data = (POP_DATA *)ctx->data;
POP_CACHE *cache;
HEADER *h = ctx->hdrs[msgno];
unsigned short bcache = 1;
/* see if we ... | cwe | CWE-119 | Unknown |
def get_last_month(db, scene):
sql = "select date from matches where scene='{}' order by date desc limit 1;".format(scene)
res = db.exec(sql)
date = res[0][0]
# If it has been more than 1 month since this last tournament,
# go ahead and round this date up by a 1 month
# eg, if the last tourname... | cwe | CWE-89 | Python |
static int ext4_split_extent(handle_t *handle,
struct inode *inode,
struct ext4_ext_path *path,
struct ext4_map_blocks *map,
int split_flag,
int flags)
{
ext4_lblk_t ee_block;
struct ext4_extent *ex;
unsigned int ee_len, depth;
int err = 0;
int uninitialized;
int split... | cwe | CWE-362 | Unknown |
#
# Copyright © 2012–2022 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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 3 of the Licens... | cwe | CWE-79 | Python |
/*
* DBD::mysql - DBI driver for the mysql database
*
* Copyright (c) 2004-2014 Patrick Galbraith
* Copyright (c) 2013-2014 Michiel Beijen
* Copyright (c) 2004-2007 Alexey Stroganov
* Copyright (c) 2003-2005 Rudolf Lippan
* Copyright (c) 1997-2003 Jochen Wiedmann
*
* You may distribute this under th... | cwe | CWE-416 | C/C++ |
void rose_stop_timer(struct sock *sk)
{
del_timer(&rose_sk(sk)->timer);
} | cwe | CWE-416 | Unknown |
'use strict';
// module to handle cookies
const urllib = require('url');
const SESSION_TIMEOUT = 1800; // 30 min
/**
* Creates a biskviit cookie jar for managing cookie values in memory
*
* @constructor
* @param {Object} [options] Optional options object
*/
class Cookies {
constructor(options) {
th... | cwe | CWE-74 | Java |
email_close(FILE *mailer)
{
char *temp;
mode_t prev_umask;
priv_state priv;
char *customSig;
if ( mailer == NULL ) {
return;
}
/* Want the letter to come from "condor" if possible */
priv = set_condor_priv();
customSig = NULL;
if ((customSig = param("EMAIL_SIGNATURE")) != NULL) {
... | cwe | CWE-134 | C/C++ |
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2019 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute i... | cwe | CWE-79 | JavaScript |
static void zend_throw_or_error(int fetch_type, zend_class_entry *exception_ce, const char *format, ...) /* {{{ */
{
va_list va;
char *message = NULL;
va_start(va, format);
zend_vspprintf(&message, 0, format, va);
if (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) {
zend_throw_error(exception_ce, message);
} else {... | cwe | CWE-134 | C/C++ |
async initAuthRoutes(router) {
// Local strategy login route (takes username and password)
router.post('/login', passport.authenticate('local'), async (req, res) => {
// return the user login response json if the login was successfull
res.json(await this.getUserLoginResponsePayload(req.user))
})... | cwe | CWE-918 | JavaScript |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const getWindow = () => (typeof window === 'undefined' ? null : window);
const readAsText = (svg) => new Promise((resolve) => {
if (!isFile(svg)) {
resolve(svg.toString('utf-8'));
}
else {
const fileReader = new Fil... | cwe | CWE-79 | Java |
pub fn clone_cstring_safely(out_ptr: *const c_char) -> Result<CString> {
if out_ptr.is_null() {
return_errno!(EINVAL, "NULL address is invalid");
}
let cstr = unsafe { CStr::from_ptr(out_ptr) };
let cstring = CString::from(cstr);
if !is_inside_user_space(out_ptr as *... | cwe | CWE-203 | Rust |
/**********************************************************************
* Copyright (c) 2008 Red Hat, Inc.
*
* File: sw-offload.c
*
* This file contains SW Implementation of checksum computation for IP,TCP,UDP
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the t... | cwe | CWE-20 | C/C++ |
int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm)
{
struct kbsentry *kbs;
u_char *q;
int sz, fnw_sz;
int delta;
char *first_free, *fj, *fnw;
int i, j, k;
int ret;
unsigned long flags;
if (!capable(CAP_SYS_TTY_CONFIG))
perm = 0;
kbs = kmalloc(sizeof(*kbs), GFP_KERNEL);
if (!kbs)... | cwe | CWE-416 | Unknown |
WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info,
const int argc,const char **argv,Image **images,ExceptionInfo *exception)
{
const char
*option;
ImageInfo
*mogrify_info;
MagickStatusType
status;
PixelInterpolateMethod
interpolate_method;
QuantizeInfo
*quantize_info... | cwe | CWE-401 | Unknown |
static int read_private_key(RSA *rsa)
{
int r;
sc_path_t path;
sc_file_t *file;
const sc_acl_entry_t *e;
u8 buf[2048], *p = buf;
size_t bufsize, keysize;
r = select_app_df();
if (r)
return 1;
sc_format_path("I0012", &path);
r = sc_select_file(card, &path, &file);
if (r) {
fprintf(stderr, "Unable to sel... | cwe | CWE-119 | Unknown |
function push () {
let value
switch (token.type) {
case 'punctuator':
switch (token.value) {
case '{':
value = {}
break
case '[':
value = []
break
}
break
case 'null':
case 'boolean':
case 'numeric':
... | cwe | CWE-1321 | JavaScript |
package org.bouncycastle.tls.crypto.impl.jcajce;
import java.io.IOException;
import java.security.PrivateKey;
import java.security.SecureRandom;
import java.security.interfaces.RSAPrivateKey;
import javax.crypto.Cipher;
import org.bouncycastle.tls.Certificate;
import org.bouncycastle.tls.ProtocolVersion;
import org.... | cwe | CWE-203 | Java |
CAMLprim value caml_bitvect_test(value bv, value n)
{
int pos = Int_val(n);
return Val_int(Byte_u(bv, pos >> 3) & (1 << (pos & 7)));
} | cwe | CWE-200 | C/C++ |
static int tsc210x_load(QEMUFile *f, void *opaque, int version_id)
{
TSC210xState *s = (TSC210xState *) opaque;
int64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
int i;
s->x = qemu_get_be16(f);
s->y = qemu_get_be16(f);
s->pressure = qemu_get_byte(f);
s->state = qemu_get_byte(f);
s->... | cwe | CWE-119 | Unknown |
package com.salesmanager.core.business.services.common.generic;
import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import com.salesmanager.core.business.exception.ServiceException;
import com.salesmanager.core.... | cwe | CWE-639 | Java |
X){null!=X.shortcut&&900>n&&!mxClient.IS_IOS?O.firstChild.nextSibling.setAttribute("title",X.shortcut):m.apply(this,arguments)};var q=App.prototype.updateUserElement;App.prototype.updateUserElement=function(){q.apply(this,arguments);if(null!=this.userElement){var O=this.userElement;O.style.cssText="position:relative;ma... | cwe | CWE-20 | JavaScript |
struct clock_source *dce80_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_s... | cwe | CWE-703 | Unknown |
static PyObject *__pyx_f_17clickhouse_driver_14bufferedreader___pyx_unpickle_CompressedBufferedReader__set_state(struct __pyx_obj_17clickhouse_driver_14bufferedreader_CompressedBufferedReader *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__p... | cwe | CWE-120 | C/C++ |
service_info *FindServiceEventURLPath(
service_table *table, const char *eventURLPath)
{
service_info *finger = NULL;
uri_type parsed_url;
uri_type parsed_url_in;
if (table &&
parse_uri(eventURLPath, strlen(eventURLPath), &parsed_url_in) ==
HTTP_SUCCESS) {
finger = table->serviceList;
while (finger) {
... | cwe | CWE-476 | C/C++ |
static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int force_reconnect)
{
HTTPContext *s = h->priv_data;
URLContext *old_hd = s->hd;
int64_t old_off = s->off;
uint8_t old_buf[BUFFER_SIZE];
int old_buf_size, ret;
AVDictionary *options = NULL;
if (whence == AVSEEK_SIZE)... | cwe | CWE-119 | Unknown |
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* th... | cwe | CWE-668 | Java |
QPDFWriter::writeLinearized()
{
// Optimize file and enqueue objects in order
discardGeneration(this->m->object_to_object_stream,
this->m->object_to_object_stream_no_gen);
bool need_xref_stream = (! this->m->object_to_object_stream.empty());
this->m->pdf.optimize(this->m->object_... | cwe | CWE-787 | Unknown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.