code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
def canonicalize(self):
"""::
path = path.canonicalize()
Canonicalize path. ::
# "/foo/baz"
Pyjo.Path.new('/foo/./bar/../baz').canonicalize()
# "/../baz"
Pyjo.Path.new('/foo/../bar/../../baz').canonicalize()
"""
parts = self... | cwe | CWE-22 | Python |
def cluster_enable(params, request, session)
if params[:name]
code, response = send_request_with_token(
session, params[:name], 'cluster_enable', true
)
else
if not allowed_for_local_cluster(session, Permissions::WRITE)
return 403, 'Permission denied'
end
success = enable_cluster(ses... | cwe | CWE-384 | Ruby |
/* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-20 | Python |
bool TextureManager::TextureInfo::ValidForTexture(
GLint face,
GLint level,
GLint xoffset,
GLint yoffset,
GLsizei width,
GLsizei height,
GLenum format,
GLenum type) const {
size_t face_index = GLTargetToFaceIndex(face);
if (level >= 0 && face_index < level_infos_.size() &&
st... | cwe | CWE-189 | C/C++ |
// Copyright 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | cwe | CWE-78 | JavaScript |
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#include "delta.h"
/* maximum hash entry list for the same hash bucket */
#define HASH_LIMIT 64
#defin... | cwe | CWE-190 | C/C++ |
public void performTest()
throws Exception
{
byte[] derivation = Hex.decode("202122232425262728292a2b2c2d2e2f");
byte[] encoding = Hex.decode("303132333435363738393a3b3c3d3e3f");
IESCipher c1 = new org.bouncycastle.jcajce.provider.asymmetric.dh.IESCipher.IES();
IE... | cwe | CWE-310 | Java |
void dtls1_stop_timer(SSL *s)
{
/* Reset everything */
memset(&(s->d1->timeout), 0, sizeof(struct dtls1_timeout_st));
memset(&(s->d1->next_timeout), 0, sizeof(struct timeval));
s->d1->timeout_duration = 1;
BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0,
&(s->d1->next_timeo... | cwe | CWE-399 | Unknown |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
OpData* data = reinterpret_cast<OpData*>(node->user_data);
bool has_bias = NumInputs(node) == 4;
// Sanity checks on op
TF_LITE_ENSURE(context, has_bias || NumInputs(node) == 3);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
// Retrieve ... | cwe | CWE-125 | C/C++ |
/*
* MOV demuxer
* Copyright (c) 2001 Fabrice Bellard
* Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
*
* first version by Francois Revol <revol@free.fr>
* seek function by Gael Chardon <gael.dev@4now.net>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can ... | cwe | CWE-787 | C/C++ |
static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_field *field,
struct hid_usage *usage)
{
struct input_dev *input = hidinput->input;
struct hid_device *device = input_get_drvdata(input);
int max = 0, code;
unsigned long *bit = NULL;
field->hidinput = hidinput;
if (field->flag... | cwe | CWE-787 | Unknown |
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS I... | cwe | CWE-22 | Python |
/*
* . .o8 oooo
* .o8 "888 `888
* .o888oo oooo d8b oooo oooo .oooo888 .ooooo. .oooo.o 888 oooo
* 888 `888""8P `888 `888 d88' `888 d88' `88b d88( "8 888 .8P'
* 888 888 888 888 8... | cwe | CWE-269 | JavaScript |
int shadow_server_start(rdpShadowServer* server)
{
BOOL ipc;
BOOL status;
WSADATA wsaData;
if (!server)
return -1;
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
return -1;
#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
#endif
server->screen = shadow_screen_new(server);
if (!server->screen)
{
WLog_ERR(TAG,... | cwe | CWE-703 | Unknown |
/*
* linux/fs/lockd/svclock.c
*
* Handling of server-side locks, mostly of the blocked variety.
* This is the ugliest part of lockd because we tread on very thin ice.
* GRANT and CANCEL calls may get stuck, meet in mid-flight, etc.
* IMNSHO introducing the grant callback into the NLM protocol was one
* of the wo... | cwe | CWE-399 | C/C++ |
hybiReadAndDecode(ws_ctx_t *wsctx, char *dst, int len, int *sockRet, int nInBuf)
{
int n;
int i;
int toReturn; /* number of data bytes to return */
int toDecode; /* number of bytes to decode starting at wsctx->writePos */
int bufsize;
int nextRead;
unsigned char *data;
uint32_t *data32;
/* if data wa... | cwe | CWE-787 | C/C++ |
def jstree_data(node, selected_node):
result = []
result.append('{')
result.append('"text": "{}",'.format(node.label))
result.append(
'"state": {{ "opened": true, "selected": {} }},'.format(
'true' if node == selected_node else 'false'
)
)
result.append(
'"dat... | cwe | CWE-79 | Python |
static struct rtable *geneve_get_v4_rt(struct sk_buff *skb,
struct net_device *dev,
struct geneve_sock *gs4,
struct flowi4 *fl4,
const struct ip_tunnel_info *info)
{
bool use_cache = ip_tunnel_dst_cache_usable(skb, info);
struct geneve_dev *geneve = netdev_priv(dev);
struc... | cwe | CWE-319 | Unknown |
// Copyright 2014 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package form
import (
"net/url"
"strings"
"github.com/go-macaron/binding"
"github.com/unknwon/com"
"gopkg.in/macaron.v1"
"gogs.io/gogs/internal/db"
)... | cwe | CWE-918 | Go |
var firstRender = true;
Grocy.IsMealPlanEntryEditAction = false;
Grocy.MealPlanEntryEditObjectId = -1;
var firstDay = null;
if (!Grocy.CalendarFirstDayOfWeek.isEmpty())
{
firstDay = parseInt(Grocy.CalendarFirstDayOfWeek);
}
if (!Grocy.MealPlanFirstDayOfWeek.isEmpty())
{
firstDay = parseInt(Grocy.MealPlanFirstDayOfW... | cwe | CWE-79 | JavaScript |
unlink($file); //maybe shorten to just unlink($filepath.'/'.$filename); - well this does test to see if it is there
}
$sql = "DELETE from categories_to_documents where document_id IN (SELECT id from documents where documents.url like ?)";
sqlQuery($sql, array("%".$filename));
$sql = "DE... | cwe | CWE-89 | PHP |
'use strict'
/**
* Module dependencies
*/
var events = require('events')
var Store = require('./store')
var eos = require('end-of-stream')
var mqttPacket = require('mqtt-packet')
var Writable = require('readable-stream').Writable
var inherits = require('inherits')
var reInterval = require('reinterval')
var validatio... | cwe | CWE-674 | JavaScript |
static int sh_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {
ut8 op_MSB,op_LSB;
int ret;
if (!data)
return 0;
memset (op, '\0', sizeof (RAnalOp));
op->addr = addr;
op->type = R_ANAL_OP_TYPE_UNK;
op->jump = op->fail = -1;
op->ptr = op->val = -1;
op->size = 2;
op_MSB = anal->big_e... | cwe | CWE-125 | C/C++ |
IntegrationStreamDecoderPtr HttpIntegrationTest::sendRequestAndWaitForResponse(
const Http::TestHeaderMapImpl& request_headers, uint32_t request_body_size,
const Http::TestHeaderMapImpl& response_headers, uint32_t response_size, int upstream_index) {
ASSERT(codec_client_ != nullptr);
// Send the request to ... | cwe | CWE-400 | C/C++ |
/**
* OpenKM, Open Document Management System (http://www.openkm.com)
* Copyright (c) 2006-2016 Paco Avila & Josep Llort
* <p>
* No bytes were intentionally harmed during the development of this application.
* <p>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the ... | cwe | CWE-611 | Java |
mrb_obj_clone(mrb_state *mrb, mrb_value self)
{
struct RObject *p;
mrb_value clone;
if (mrb_immediate_p(self)) {
mrb_raisef(mrb, E_TYPE_ERROR, "can't clone %S", self);
}
if (mrb_type(self) == MRB_TT_SCLASS) {
mrb_raise(mrb, E_TYPE_ERROR, "can't clone singleton class");
}
p = (struct RObject*)mrb_... | cwe | CWE-476 | C/C++ |
/* 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-476 | C/C++ |
static Image *ReadVIDImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
#define ClientName "montage"
char
**filelist,
*label,
**list;
Image
*image,
*images,
*montage_image,
*next_image,
*thumbnail_image;
ImageInfo
*read_info;
int
number_files;
MagickBoo... | cwe | CWE-476 | C/C++ |
void AppListController::Init(Profile* initial_profile) {
if (win8::IsSingleWindowMetroMode())
return;
PrefService* prefs = g_browser_process->local_state();
if (prefs->HasPrefPath(prefs::kRestartWithAppList) &&
prefs->GetBoolean(prefs::kRestartWithAppList)) {
prefs->SetBoolean(prefs::kRestartWithAp... | cwe | CWE-399 | C/C++ |
def set_body(self, body):
self.data = yaml.load(body) | cwe | CWE-502 | Python |
def send_password
Log.add_info(request, params.inspect)
begin
users = User.where("email='#{params[:thetisBoxEdit]}'").to_a
rescue => evar
end
if users.nil? or users.empty?
Log.add_error(request, evar)
flash[:notice] = 'ERROR:' + t('email.address_not_found')
else
user_pa... | cwe | CWE-89 | Ruby |
/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unl... | cwe | CWE-91 | Java |
error_response_cache(struct module_qstate* qstate, int id, int rcode)
{
if(!qstate->no_cache_store) {
/* store in cache */
struct reply_info err;
if(qstate->prefetch_leeway > NORR_TTL) {
verbose(VERB_ALGO, "error response for prefetch in cache");
/* attempt to adjust the cache entry prefetch */
if(dns_c... | cwe | CWE-613 | Unknown |
vips_foreign_load_start( VipsImage *out, void *a, void *b )
{
VipsForeignLoad *load = VIPS_FOREIGN_LOAD( b );
VipsForeignLoadClass *class = VIPS_FOREIGN_LOAD_GET_CLASS( load );
if( !load->real ) {
if( !(load->real = vips_foreign_load_temp( load )) )
return( NULL );
#ifdef DEBUG
printf( "vips_foreign_l... | cwe | CWE-362 | C/C++ |
package com.salesmanager.shop.admin.controller.merchant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.inject.Inject;
import javax.servlet.http.H... | cwe | CWE-79 | Java |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
// Check for supported activation types.
auto* params =
reinterpret_cast<TfLiteFullyConnectedParams*>(node->builtin_data);
const TfLiteTensor* filter = GetInput(context, node, kWeightsTensor);
const TfLiteTensor* input = GetInput(context, no... | cwe | CWE-787 | C/C++ |
package com.salesmanager.shop.admin.controller.content;
import com.salesmanager.core.business.services.catalog.product.relationship.ProductRelationshipService;
import com.salesmanager.core.business.services.content.ContentService;
import com.salesmanager.core.business.services.reference.language.LanguageService;
impor... | cwe | CWE-639 | Java |
bool RendererPermissionsPolicyDelegate::IsRestrictedUrl(
const GURL& document_url,
std::string* error) {
if (dispatcher_->IsExtensionActive(kWebStoreAppId)) {
if (error)
*error = errors::kCannotScriptGallery;
return true;
}
if (SearchBouncer::GetInstance()->IsNewTabPage(document_url)) {
... | cwe | CWE-285 | Unknown |
internal func sign(digest: ByteBuffer) throws -> ByteBuffer {
let bio = BIO_new(BIO_s_mem())
defer { BIO_free(bio) }
let res = buffer.withUnsafeReadableBytes { ptr in
Int(BIO_puts(bio, ptr.baseAddress?.assumingMemoryBound(to: Int8.self)))
}
assert(res >= 0, "BIO_puts ... | cwe | CWE-122 | Swift |
def get_requested_day(self, date):
data = dict()
day_start, day_end = self.get_epoch_day(date)
data['interval'] = {'from': self.convert_local_ts_to_utc(day_start, self.local_timezone), 'to': self.convert_local_ts_to_utc(day_end, self.local_timezone)}
query = '''
SELECT Tim... | cwe | CWE-89 | Python |
def AsyncGetActionRateLimited(rateLimits: RateLimits)(f: GetRequest => Future[Result])
: mvc.Action[Unit] =
PlainApiAction(cc.parsers.empty, rateLimits).async(f) | cwe | CWE-613 | Scala |
rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,
int bytesPerPixel) {
#ifdef WIN32
WSADATA unused;
#endif
rfbClient* client=(rfbClient*)calloc(sizeof(rfbClient),1);
if(!client) {
rfbClientErr("Couldn't allocate client structure!\n");
return NULL;
}
#ifdef WIN32
if((errno = WSAStartu... | cwe | CWE-703 | Unknown |
/*
** codegen.c - mruby code generator
**
** See Copyright Notice in mruby.h
*/
#include <mruby.h>
#include <mruby/compile.h>
#include <mruby/proc.h>
#include <mruby/dump.h>
#include <mruby/numeric.h>
#include <mruby/string.h>
#include <mruby/debug.h>
#include <mruby/presym.h>
#include "node.h"
#include <mruby/opcode.... | cwe | CWE-122 | C/C++ |
func (u *SessionUtil) createSudoersFileIfNotPresent(log log.T) error {
// Return if the file exists
if _, err := os.Stat(sudoersFile); err == nil {
log.Infof("File %s already exists", sudoersFile)
_ = u.changeModeOfSudoersFile(log)
return err
}
// Create a sudoers file for ssm-user
file, err := os.Create(s... | cwe | CWE-732 | Go |
void btrfs_trans_release_chunk_metadata(struct btrfs_trans_handle *trans)
{
struct btrfs_fs_info *fs_info = trans->fs_info;
struct btrfs_transaction *cur_trans = trans->transaction;
if (!trans->chunk_bytes_reserved)
return;
WARN_ON_ONCE(!list_empty(&trans->new_bgs));
btrfs_block_rsv_release(fs_info, &fs_info-... | cwe | CWE-703 | Unknown |
bool GLES2DecoderImpl::SimulateFixedAttribs(
GLuint max_vertex_accessed, bool* simulated) {
DCHECK(simulated);
*simulated = false;
if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2)
return true;
if (!vertex_attrib_manager_.HaveFixedAttribs()) {
return true;
}
int num_vertices ... | 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 |
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
systemd 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... | cwe | CWE-264 | C/C++ |
private ModelAndView renameGroup(HttpServletRequest request, HttpServletResponse response) throws Exception {
String oldName = request.getParameter("groupName");
String newName = request.getParameter("newName");
if (StringUtils.hasText(oldName) && StringUtils.hasText(newName)) ... | cwe | CWE-79 | JavaScript |
int kvm_create_lapic(struct kvm_vcpu *vcpu, int timer_advance_ns)
{
struct kvm_lapic *apic;
ASSERT(vcpu != NULL);
apic = kzalloc(sizeof(*apic), GFP_KERNEL_ACCOUNT);
if (!apic)
goto nomem;
vcpu->arch.apic = apic;
apic->regs = (void *)get_zeroed_page(GFP_KERNEL_ACCOUNT);
if (!apic->regs) {
printk(KERN_ERR ... | cwe | CWE-459 | Unknown |
package defaults
import (
"time"
)
const (
// these requests take at _least_ two minutes at the moment.
ProvideTimeout = time.Minute * 3
ProvSearchDelay = time.Second
// Number of concurrent workers in decision engine that process requests to the blockstore
BitswapEngineBlockstoreWorkerCount = 128
// the tot... | cwe | CWE-400 | Go |
void ConnectionImpl::StreamImpl::encodeData(Buffer::Instance& data, bool end_stream) {
ASSERT(!local_end_stream_);
local_end_stream_ = end_stream;
pending_send_data_.move(data);
if (data_deferred_) {
int rc = nghttp2_session_resume_data(parent_.session_, stream_id_);
ASSERT(rc == 0);
data_deferred_... | cwe | CWE-400 | Unknown |
static int get_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
{
return usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
RTL8150_REQ_GET_REGS, RTL8150_REQT_READ,
indx, 0, data, size, 500);
} | cwe | CWE-119 | C/C++ |
/*
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator p... | cwe | CWE-200 | Java |
static int crypto_report_kpp(struct sk_buff *skb, struct crypto_alg *alg)
{
struct crypto_report_kpp rkpp;
strlcpy(rkpp.type, "kpp", sizeof(rkpp.type));
if (nla_put(skb, CRYPTOCFGA_REPORT_KPP,
sizeof(struct crypto_report_kpp), &rkpp))
goto nla_put_failure;
return 0;
nla_put_failure:
return -EMSGSIZE;
} | cwe | CWE-200 | Unknown |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class PortalSettings(Document):
def add_item(self, item):
'''insert new portal menu i... | cwe | CWE-79 | Python |
public function resetauthkey($id = null)
{
if (!$this->_isAdmin() && Configure::read('MISP.disableUserSelfManagement')) {
throw new MethodNotAllowedException('User self-management has been disabled on this instance.');
}
if ($id == 'me') {
$id = $this->Auth->user('id'... | cwe | CWE-269 | PHP |
int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
const unsigned char *from, int flen, int num,
const unsigned char *param, int plen)
{
int i, dblen, mlen = -1;
const unsigned char *maskeddb;
int lzero;
unsigned char *db = NULL, seed[SHA_DIGEST_LENGTH], phash[SHA_DIGEST_LENGTH];
unsigned char *padde... | cwe | CWE-310 | Unknown |
/***************************************************************************
* Copyright (C) 2005-2015 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This pr... | cwe | CWE-17 | C/C++ |
void qemu_ram_free(struct uc_struct *uc, RAMBlock *block)
{
if (!block) {
return;
}
//if (block->host) {
// ram_block_notify_remove(block->host, block->max_length);
//}
QLIST_REMOVE(block, next);
uc->ram_list.mru_block = NULL;
/* Write list before version */
//smp_wmb();... | cwe | CWE-476 | C/C++ |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2000-2012
* All rights reserved
*
* This file is part of GPAC / Media Tools sub-project
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser Gene... | cwe | CWE-119 | C/C++ |
function path_f ($path)
{
global $home_dir;
$abs_dir = $home_dir;
switch ($path)
{
case '.':
case '': return realpath($abs_dir);
}
return realpath(realpath($home_dir) . "/$path");
} | cwe | CWE-22 | PHP |
notifies.updateAdminNotifies = function updateAdminNotifies() {
var src = '/api/v1/adminnotifies?t=' + new Date().getTime();
$.ajax({
method: 'GET'
, url: src
, headers: client.headers()
}).done(function success (results) {
if (results.message) {
var m = results.message;
... | cwe | CWE-79 | JavaScript |
static void xcopy_pt_undepend_remotedev(struct xcopy_op *xop)
{
struct se_device *remote_dev;
if (xop->op_origin == XCOL_SOURCE_RECV_OP)
remote_dev = xop->dst_dev;
else
remote_dev = xop->src_dev;
pr_debug("Calling configfs_undepend_item for"
" remote_dev: %p remote_dev->dev_group: %p\n",
remote_dev, &... | cwe | CWE-22 | Unknown |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2000-2021
* All rights reserved
*
* This file is part of GPAC / ISO Media File Format sub-project
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU L... | cwe | CWE-476 | C/C++ |
/* vi: set sw=4 ts=4:
*
* picocom.c
*
* simple dumb-terminal program. Helps you manually configure and test
* stuff like modems, devices w. serial ports etc.
*
* by Nick Patavalis (npat@efault.net)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General... | cwe | CWE-77 | C/C++ |
skip_string(char_u *p)
{
int i;
// We loop, because strings may be concatenated: "date""time".
for ( ; ; ++p)
{
if (p[0] == '\'') // 'c' or '\n' or '\000'
{
if (p[1] == NUL) // ' at end of line
break;
i = 2;
if (p[1] == '\\' && p[2] != NUL) // '\n' or '\000'
{
... | cwe | CWE-787 | C/C++ |
static FILE *open_log_file(void)
{
if(log_fp) /* keep it open unless we rotate */
return log_fp;
log_fp = fopen(log_file, "a+");
if(log_fp == NULL) {
if (daemon_mode == FALSE) {
printf("Warning: Cannot open log file '%s' for writing\n", log_file);
}
return NULL;
}
(void)fcntl(fileno(log_fp... | cwe | CWE-59 | C/C++ |
static Var* Pe_r_bin_pe_parse_var(RBinPEObj* pe, PE_DWord* curAddr) {
Var* var = calloc (1, sizeof (*var));
if (!var) {
pe_printf ("Warning: calloc (Var)\n");
return NULL;
}
if ((var->wLength = r_buf_read_le16_at (pe->b, *curAddr)) == UT16_MAX) {
pe_printf ("Warning: read (Var wLength)\n");
free_Var (var);
... | cwe | CWE-400 | C/C++ |
file_add_mapi_attrs (File* file, MAPI_Attr** attrs)
{
int i;
for (i = 0; attrs[i]; i++)
{
MAPI_Attr* a = attrs[i];
if (a->num_values)
{
switch (a->name)
{
case MAPI_ATTACH_LONG_FILENAME:
if (file->name) XFREE(file->name);
file->name = strdup( (char*)a->values[0].data.buf );
b... | cwe | CWE-787 | C/C++ |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2020 University of Dundee & Open Microscopy Environment.
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software F... | cwe | CWE-601 | Python |
this.send = function(data) {
if (this.readyState != this.OPENED) {
throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");
}
if (sendFlag) {
throw new Error("INVALID_STATE_ERR: send has already been called");
}
var ssl = false, local = false;
var ur... | cwe | CWE-295 | JavaScript |
static ssize_t mon_text_read_t(struct file *file, char __user *buf,
size_t nbytes, loff_t *ppos)
{
struct mon_reader_text *rp = file->private_data;
struct mon_event_text *ep;
struct mon_text_ptr ptr;
ep = mon_text_read_wait(rp, file);
if (IS_ERR(ep))
return PTR_ERR(ep);
mutex_lock(&rp->printf_lock);
ptr.c... | cwe | CWE-787 | Unknown |
package org.mozilla.jss.ssl.javax;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.WritableByteChannel;
import java.security.PublicKey;
import javax.net.ssl.SSLEngineR... | cwe | CWE-401 | Java |
crun_command_exec (struct crun_global_arguments *global_args, int argc, char **argv, libcrun_error_t *err)
{
int first_arg = 0, ret = 0;
libcrun_context_t crun_context = {
0,
};
cleanup_process_schema runtime_spec_schema_config_schema_process *process = NULL;
struct libcrun_container_exec_options_s exec_o... | cwe | CWE-276 | C/C++ |
void NetworkHandler::SetNetworkConditions(
network::mojom::NetworkConditionsPtr conditions) {
if (!process_)
return;
StoragePartition* partition = process_->GetStoragePartition();
network::mojom::NetworkContext* context = partition->GetNetworkContext();
context->SetNetworkConditions(host_id_, std::mo... | cwe | CWE-20 | C/C++ |
//===- llvm/ADT/SmallVector.cpp - 'Normally small' vectors ----------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-------------------------------------------------------... | cwe | CWE-787 | C/C++ |
function paginateComments(page) {
$.get(commentsListUrl, {page: page}, function(result) {
const jsonResponse = JSON.parse(result);
if (jsonResponse.comments && jsonResponse.comments.length > 0) {
populateComments(jsonResponse.comments);
if (jsonResponse.comments_nb > jsonResponse.commen... | cwe | CWE-79 | JavaScript |
public function downloadfile() {
if (empty($this->params['fileid'])) {
flash('error', gt('There was an error while trying to download your file. No File Specified.'));
expHistory::back();
}
$fd = new filedownload($this->params['fileid']);
if (empty($thi... | cwe | CWE-89 | PHP |
static int __netlink_deliver_tap_skb(struct sk_buff *skb,
struct net_device *dev)
{
struct sk_buff *nskb;
struct sock *sk = skb->sk;
int ret = -ENOMEM;
dev_hold(dev);
if (is_vmalloc_addr(skb->head))
nskb = netlink_to_full_skb(skb, GFP_ATOMIC);
else
nskb = skb_clone(skb, GFP_ATOMIC);
if (nskb) {
... | cwe | CWE-200 | Unknown |
_dbus_marshal_validate_test (void)
{
DBusString str;
int i;
const char *valid_paths[] = {
"/",
"/foo/bar",
"/foo",
"/foo/bar/baz"
};
const char *invalid_paths[] = {
"bar",
"bar/baz",
"/foo/bar/",
"/foo/"
"foo/",
"boo//blah",
"//",
"///",
"foo///blah/",
... | cwe | CWE-20 | Unknown |
static int fastrpc_dma_buf_attach(struct dma_buf *dmabuf,
struct dma_buf_attachment *attachment)
{
struct fastrpc_dma_buf_attachment *a;
struct fastrpc_buf *buffer = dmabuf->priv;
int ret;
a = kzalloc(sizeof(*a), GFP_KERNEL);
if (!a)
return -ENOMEM;
ret = dma_get_sgtable(buffer->dev, &a->sgt, buffer->vi... | cwe | CWE-401 | C/C++ |
JBIG2Bitmap::JBIG2Bitmap(Guint segNumA, int wA, int hA):
JBIG2Segment(segNumA)
{
w = wA;
h = hA;
line = (wA + 7) >> 3;
if (w <= 0 || h <= 0 || line <= 0 || h >= (INT_MAX - 1) / line) {
error(-1, "invalid width/height");
data = NULL;
return;
}
data = (Guchar *)gmalloc(h * line + 1);
data[... | cwe | CWE-189 | C/C++ |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
const auto* params = reinterpret_cast<TfLiteSVDFParams*>(node->builtin_data);
OpData* op_data = reinterpret_cast<OpData*>(node->user_data);
int scratch_tensor_index = op_data->scratch_tensor_index;
// Check we have all the inputs and outputs we n... | cwe | CWE-908 | Unknown |
static int mcryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
struct mcryptd_queue *queue)
{
struct hashd_instance_ctx *ctx;
struct ahash_instance *inst;
struct hash_alg_common *halg;
struct crypto_alg *alg;
u32 type = 0;
u32 mask = 0;
int err;
mcryptd_check_internal(tb, &type, &mas... | cwe | CWE-476 | C/C++ |
void OnImageDecoded(const gfx::Image& decoded_image) {
image_decoded_callback_.Run(decoded_image.AsBitmap());
delete this;
} | cwe | CWE-119 | C/C++ |
MagickExport MagickBooleanType SetImageType(Image *image,const ImageType type,
ExceptionInfo *exception)
{
const char
*artifact;
ImageInfo
*image_info;
MagickBooleanType
status;
QuantizeInfo
*quantize_info;
assert(image != (Image *) NULL);
if (image->debug != MagickFalse)
(void) Lo... | cwe | CWE-416 | C/C++ |
/**
* OpenKM, Open Document Management System (http://www.openkm.com)
* Copyright (c) 2006-2016 Paco Avila & Josep Llort
* <p>
* No bytes were intentionally harmed during the development of this application.
* <p>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the ... | cwe | CWE-611 | Java |
cib_remote_connection_destroy(gpointer user_data)
{
cib_client_t *client = user_data;
if (client == NULL) {
return;
}
crm_trace("Cleaning up after client disconnect: %s/%s",
crm_str(client->name), client->id);
if (client->id != NULL) {
if (!g_hash_table_remove(c... | cwe | CWE-399 | C/C++ |
static int __init xfrm6_tunnel_init(void)
{
int rv;
rv = xfrm_register_type(&xfrm6_tunnel_type, AF_INET6);
if (rv < 0)
goto err;
rv = xfrm6_tunnel_register(&xfrm6_tunnel_handler, AF_INET6);
if (rv < 0)
goto unreg;
rv = xfrm6_tunnel_register(&xfrm46_tunnel_handler, AF_INET);
if (rv < 0)
goto dereg6;
rv = ... | cwe | CWE-362 | C/C++ |
Ins_GETVARIATION( TT_ExecContext exc,
FT_Long* args )
{
FT_UInt num_axes = exc->face->blend->num_axis;
FT_Fixed* coords = exc->face->blend->normalizedcoords;
FT_UInt i;
if ( BOUNDS( num_axes, exc->stackSize + 1 - exc->top ) )
{
exc->error = FT_THROW( Sta... | cwe | CWE-476 | C/C++ |
NavigateToAboutBlank() {
GURL about_blank(url::kAboutBlankURL);
content::NavigationController::LoadURLParams params(about_blank);
params.frame_tree_node_id = frame_tree_node_id_;
params.source_site_instance = parent_site_instance_;
params.is_renderer_initiated = true;
web_contents()->GetController().LoadURL... | cwe | CWE-787 | C/C++ |
/*
* Copyright (c) 2015. David Sowerby
*
* 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 wri... | cwe | CWE-89 | Java |
package data_loader
import (
"encoding/json"
"github.com/sirupsen/logrus"
"github.com/TykTechnologies/tyk-identity-broker/configuration"
"github.com/TykTechnologies/tyk-identity-broker/tap"
"io/ioutil"
"path"
"strconv"
"time"
)
// FileLoader implements DataLoader and will load TAP Profiles from a file
type Fi... | cwe | CWE-287 | Go |
static NTSTATUS fd_open_atomic(struct connection_struct *conn,
files_struct *fsp,
int flags,
mode_t mode,
bool *file_created)
{
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
bool file_existed = VALID_STAT(fsp->fsp_name->st);
*file_created = false;
if (!(flags & O_CREAT)) {
/*
* We're not creating the... | cwe | CWE-835 | Unknown |
static void setAppDefaults()
{
app->company = stok(slower(ME_COMPANY), " ", NULL);
app->serviceProgram = sclone(SERVICE_PROGRAM);
app->serviceName = sclone(SERVICE_NAME);
app->serviceHome = mprGetNativePath(SERVICE_HOME);
app->retries = RESTART_MAX;
app->signal = SIGTERM;
app->logSpec = sclo... | cwe | CWE-476 | C/C++ |
s32 vvc_parse_picture_header(GF_BitStream *bs, VVCState *vvc, VVCSliceInfo *si)
{
u32 pps_id;
si->irap_or_gdr_pic = gf_bs_read_int_log(bs, 1, "irap_or_gdr_pic");
si->non_ref_pic = gf_bs_read_int_log(bs, 1, "non_ref_pic");
if (si->irap_or_gdr_pic)
si->gdr_pic = gf_bs_read_int_log(bs, 1, "gdr_pic");
if ((si->inte... | cwe | CWE-190 | C/C++ |
package datastore
import (
"context"
"github.com/stackrox/rox/central/notifier/datastore/internal/store"
"github.com/stackrox/rox/generated/storage"
)
// DataStore provides storage functionality for notifiers.
//go:generate mockgen-wrapper
type DataStore interface {
GetNotifier(ctx context.Context, id string) (*... | cwe | CWE-668 | Go |
void Compute(OpKernelContext* context) override {
typedef Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>>
ConstEigenMatrixMap;
typedef Eigen::Map<Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>>
EigenMatrixMap;
constexpr int tensor_in_and_out_dims = 4;
const Tensor&... | cwe | CWE-369 | C/C++ |
hostkey_method_ssh_ed25519_init(LIBSSH2_SESSION * session,
const unsigned char *hostkey_data,
size_t hostkey_data_len,
void **abstract)
{
const unsigned char *s;
unsigned long len, key_len;
libssh2_ed25519_ctx *c... | cwe | CWE-787 | Unknown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.