code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
TPMI_RH_ACT_Unmarshal( TPMI_RH_ACT *target, BYTE **buffer, INT32 *size)
{
TPM_RC rc = TPM_RC_SUCCESS;
if (rc == TPM_RC_SUCCESS) {
rc = TPM_HANDLE_Unmarshal(target, buffer, size);
}
if (rc == TPM_RC_SUCCESS) {
BOOL isNotACT = (*target < TPM_RH_ACT_0) || (*target > TPM_RH_ACT_F);
if (isNotACT) {
... | cwe | CWE-787 | Unknown |
const bootbox = require('bootbox');
require('../services/Requisitions');
require('../services/Synchronize');
/**
* @author Alejandro Galue <agalue@opennms.org>
* @copyright 2014 The OpenNMS Group, Inc.
*/
(function() {
'use strict';
const quickAddNodeView = require('../../views/quick-add-node.html');
const c... | cwe | CWE-79 | Java |
/**
* @file CoinSpend.cpp
*
* @brief CoinSpend class for the Zerocoin library.
*
* @author Ian Miers, Christina Garman and Matthew Green
* @date June 2013
*
* @copyright Copyright 2013 Ian Miers, Christina Garman and Matthew Green
* @license This project is released under the MIT licen... | cwe | CWE-345 | C/C++ |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
const auto* params = reinterpret_cast<TfLiteBidirectionalSequenceRNNParams*>(
node->builtin_data);
// Check we have all the inputs and outputs we need.
TF_LITE_ENSURE_EQ(context, node->inputs->size, 12);
TF_LITE_ENSURE_EQ(context, node->out... | cwe | CWE-787 | C/C++ |
def _get_3par_host(self, hostname):
out = self._cli_run('showhost -verbose %s' % (hostname), None)
LOG.debug("OUTPUT = \n%s" % (pprint.pformat(out)))
host = {'id': None, 'name': None,
'domain': None,
'descriptors': {},
'iSCSIPaths': [],
... | cwe | CWE-78 | Python |
void PaymentRequest::Show(bool is_user_gesture) {
if (!client_.is_bound() || !binding_.is_bound()) {
LOG(ERROR) << "Attempted Show(), but binding(s) missing.";
OnConnectionTerminated();
return;
}
display_handle_ = display_manager_->TryShow(delegate_.get());
if (!display_handle_) {
LOG(ERR... | cwe | CWE-189 | C/C++ |
def self.execute_action_move(mail_filter, email, val)
mail_folder_id = val
mail_folder = MailFolder.find_by_id(mail_folder_id)
if !mail_folder.nil? and (mail_folder.user_id == email.user_id)
email.update_attribute(:mail_folder_id, mail_folder_id)
end
return true
end | cwe | CWE-89 | Ruby |
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
* Copyright (c) 2014- QLogic Corporation.
* All rights reserved
* www.qlogic.com
*
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
*/
/*
* bfa_attr.c Linux driver configuration interf... | cwe | CWE-401 | C/C++ |
/*
* Copyright 2014-2018 the original author or 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 app... | cwe | CWE-94 | Java |
static int ax25_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t size, int flags)
{
struct sock *sk = sock->sk;
struct sk_buff *skb;
int copied;
int err = 0;
lock_sock(sk);
/*
* This works for seqpacket too. The receiver has ordered the
* queue for us! We do one quick check first... | cwe | CWE-20 | C/C++ |
int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
{
int al,i,j,ret;
unsigned int n;
SSL3_RECORD *rr;
void (*cb)(const SSL *ssl,int type2,int val)=NULL;
if (s->s3->rbuf.buf == NULL) /* Not initialized yet */
if (!ssl3_setup_read_buffer(s))
return(-1);
if ((type && (type != SSL3_R... | cwe | CWE-310 | Unknown |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre, Cyril Concolato
* Copyright (c) Telecom ParisTech 2000-2022
* All rights reserved
*
* This file is part of GPAC / Scene Management sub-project
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms ... | cwe | CWE-401 | C/C++ |
void qemu_chr_fe_deinit(CharBackend *b)
{
assert(b);
if (b->chr) {
qemu_chr_fe_set_handlers(b, NULL, NULL, NULL, NULL, NULL);
b->chr->avail_connections++;
b->chr = NULL;
}
} | cwe | CWE-416 | Unknown |
/*
Copyright 2008-2017 LibRaw LLC (info@libraw.org)
LibRaw is free software; you can redistribute it and/or modify
it under the terms of the one of two licenses as you choose:
1. GNU LESSER GENERAL PUBLIC LICENSE version 2.1
(See file LICENSE.LGPL provided in LibRaw distribution archive for details).
2. COMMON... | cwe | CWE-125 | C/C++ |
func (r *TokenRevocationHandler) RevokeToken(ctx context.Context, token string, tokenType fosite.TokenType, client fosite.Client) error {
discoveryFuncs := []func() (request fosite.Requester, err error){
func() (request fosite.Requester, err error) {
// Refresh token
signature := r.RefreshTokenStrategy.Refresh... | cwe | CWE-755 | Go |
static size_t curl_read_cb(void *ptr, size_t size, size_t nmemb, void *opaque)
{
CURLState *s = ((CURLState*)opaque);
size_t realsize = size * nmemb;
int i;
DPRINTF("CURL: Just reading %zd bytes\n", realsize);
if (!s || !s->orig_buf)
goto read_end;
memcpy(s->orig_buf + s->buf_off, ptr... | cwe | CWE-20 | C/C++ |
copySync: function (from, dist) {
this._supportExecSync();
try {
var cmd = '';
var stats = fs.lstatSync(from);
dist = path.resolve(dist);
if (stats.isDirectory()) {
if (this._win32) {
// windows
cmd = 'echo da|xcopy /s /e "' + path.join(from, '*') + '" "' + di... | cwe | CWE-77 | JavaScript |
static port::StatusOr<CudnnRnnSequenceTensorDescriptor> Create(
GpuExecutor* parent, int max_seq_length, int batch_size, int data_size,
const absl::Span<const int>& seq_lengths, bool time_major,
cudnnDataType_t data_type) {
CHECK_GT(max_seq_length, 0);
int dims[] = {batch_size, data_size, 1};
... | cwe | CWE-20 | C/C++ |
fmtint(char **sbuffer,
char **buffer,
size_t *currlen,
size_t *maxlen, LLONG value, int base, int min, int max, int flags)
{
int signvalue = 0;
const char *prefix = "";
unsigned LLONG uvalue;
char convert[DECIMAL_SIZE(value) + 3];
int place = 0;
int spadlen = 0;
int zpad... | cwe | CWE-119 | Unknown |
public static function callCurl($url, array $eopts = [], &$msgerr = null) {
global $CFG_GLPI;
$content = "";
$taburl = parse_url($url);
$defaultport = 80;
// Manage standard HTTPS port : scheme detection or port 443
if ((isset($taburl["scheme"]) && $taburl["scheme"]=='https')
... | cwe | CWE-327 | PHP |
public function onRouteStartup(Enlight_Controller_EventArgs $args)
{
$request = $args->getRequest();
if (strpos($request->getPathInfo(), '/backend') === 0
|| strpos($request->getPathInfo(), '/api/') === 0
) {
return;
}
$shop = $this->getShopByRequest... | cwe | CWE-601 | PHP |
null!=l&&l();b.openLink(f,null,!0)});c.className="geBtn gePrimaryBtn";c.style.width=D.style.width;t.appendChild(c);mxUtils.br(t);mxUtils.br(t);mxUtils.write(t,mxResources.get("allowPopups"));this.container=t},ImageDialog=function(b,f,l,d,u,t,D,c){function e(){0<m.value.length?M.removeAttribute("disabled"):M.setAttribut... | cwe | CWE-20 | JavaScript |
// Copyright 2013 Unknown
//
// 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 writ... | cwe | CWE-20 | Go |
char* HexOutStream::binToHexStr(const char* data, int length) {
char* buffer = new char[length*2+1];
for (int i=0; i<length; i++) {
buffer[i*2] = intToHex((data[i] >> 4) & 15);
buffer[i*2+1] = intToHex((data[i] & 15));
if (!buffer[i*2] || !buffer[i*2+1]) {
delete [] buffer;
return 0;
}
... | cwe | CWE-787 | C/C++ |
/*
* DVB USB framework
*
* Copyright (C) 2004-6 Patrick Boettcher <patrick.boettcher@posteo.de>
* Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
*
* 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 ... | cwe | CWE-119 | C/C++ |
bool VaapiVideoDecodeAccelerator::VaapiH264Accelerator::OutputPicture(
const scoped_refptr<H264Picture>& pic) {
scoped_refptr<VaapiDecodeSurface> dec_surface =
H264PictureToVaapiDecodeSurface(pic);
dec_surface->set_visible_rect(pic->visible_rect);
vaapi_dec_->SurfaceReady(dec_surface);
return tru... | cwe | CWE-362 | C/C++ |
GF_Err iloc_box_read(GF_Box *s, GF_BitStream *bs)
{
u32 item_count, extent_count, i, j;
GF_ItemLocationBox *ptr = (GF_ItemLocationBox *)s;
ISOM_DECREASE_SIZE(ptr, 2)
ptr->offset_size = gf_bs_read_int(bs, 4);
ptr->length_size = gf_bs_read_int(bs, 4);
ptr->base_offset_size = gf_bs_read_int(bs, 4);
if (ptr->versio... | cwe | CWE-415 | C/C++ |
GLboolean WebGLRenderingContextBase::isShader(WebGLShader* shader) {
if (!shader || isContextLost())
return 0;
return ContextGL()->IsShader(shader->Object());
} | cwe | CWE-787 | C/C++ |
$.ajax({
url : 'api/usuarios',
type : "GET",
}).done(function(resp) {
$("#usuarios").html(resp);
});
$("#pesquisar").click(function() {
$.ajax({
url : 'api/usuarios',
type : "GET",
data : {
name : $("#search").val()
... | cwe | CWE-89 | Java |
AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd,
void *dummy,
const char *arg)
{
const char *endp = ap_strrchr_c(arg, '>');
const char *limited_methods;
void *tog = cmd->cmd->cmd_... | cwe | CWE-284 | Unknown |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
OpData* data = reinterpret_cast<OpData*>(node->user_data);
auto* params = reinterpret_cast<TfLiteSubParams*>(node->builtin_data);
TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTens... | cwe | CWE-125 | C/C++ |
/*
Copyright The Helm 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, software
di... | cwe | CWE-74 | Go |
var common = require('./common');
var _tempDir = require('./tempdir').tempDir;
var _pwd = require('./pwd');
var path = require('path');
var fs = require('fs');
var child = require('child_process');
var DEFAULT_MAXBUFFER_SIZE = 20 * 1024 * 1024;
var DEFAULT_ERROR_CODE = 1;
common.register('exec', _exec, {
unix: fals... | cwe | CWE-269 | JavaScript |
NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Extension, PIRP Irp)
{
PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation (Irp);
NTSTATUS ntStatus;
switch (irpSp->Parameters.DeviceIoControl.IoControlCode)
{
case TC_IOCTL_GET_DRIVER_VERSION:
case TC_IOCTL_LEGACY_GET_DRIVER_VERSI... | cwe | CWE-787 | Unknown |
def article
@article = Article.find(params[:id])
@feedbacks = Feedback.find(:all, :conditions => "article_id = #{params[:id]}")
end | cwe | CWE-89 | Ruby |
status_t BnOMX::onTransact(
uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) {
switch (code) {
case LIVES_LOCALLY:
{
CHECK_OMX_INTERFACE(IOMX, data, reply);
node_id node = (node_id)data.readInt32();
pid_t pid = (pid_t)data.readInt32();
reply->writeInt32(livesLoc... | cwe | CWE-264 | Unknown |
bool PackLinuxElf64::calls_crt1(Elf64_Rela const *rela, int sz)
{
for (; 0 < sz; (sz -= sizeof(Elf64_Rela)), ++rela) {
unsigned const symnum = get_te64(&rela->r_info) >> 32;
char const *const symnam = get_te32(&dynsym[symnum].st_name) + dynstr;
if (0==strcmp(symnam, "__libc_start_main") // ... | cwe | CWE-415 | Unknown |
package version
import (
"strconv"
"strings"
)
// Version is the service current released version.
// Semantic versioning: https://semver.org/
var Version = "0.9.1"
// DevVersion is the service current development version.
var DevVersion = "0.9.1"
func GetCurrentVersion(mode string) string {
if mode == "dev" {
... | cwe | CWE-79 | Go |
static bool set_sockaddr(sockaddr_storage &sa_storage, req::ptr<Socket> sock,
const String& addr, int port,
struct sockaddr *&sa_ptr, size_t &sa_size) {
// Always zero it out:
// - fields are added over time; zeroing it out is future-proofing; for
// example, so... | cwe | CWE-122 | C/C++ |
package server
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"time"
"github.com/usememos/memos/api"
"github.com/usememos/memos/common"
metric "github.com/usememos/memos/plugin/metrics"
"github.com/labstack/echo/v4"
)
const (
// The max file size is 32MB.
maxFileSize = (32 * 8) << 2... | cwe | CWE-79 | Go |
int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, int *al)
{
unsigned short type;
unsigned short size;
unsigned short len;
unsigned char *data = *p;
int renegotiate_seen = 0;
int sigalg_seen = 0;
s->servername_done = 0;
s->tlsext_status_type = -1;
#ifndef OPENSSL_NO_NEXTPROT... | cwe | CWE-20 | Unknown |
static void Sp_search(js_State *J)
{
js_Regexp *re;
const char *text;
Resub m;
text = checkstring(J, 0);
if (js_isregexp(J, 1))
js_copy(J, 1);
else if (js_isundefined(J, 1))
js_newregexp(J, "", 0);
else
js_newregexp(J, js_tostring(J, 1), 0);
re = js_toregexp(J, -1);
if (!js_regexec(re->prog, text, &m... | cwe | CWE-674 | Unknown |
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-20 | Python |
int TLSOutStream::writeTLS(const U8* data, int length)
{
int n;
n = gnutls_record_send(session, data, length);
if (n == GNUTLS_E_INTERRUPTED || n == GNUTLS_E_AGAIN)
return 0;
if (n < 0)
throw TLSException("writeTLS", n);
return n;
} | cwe | CWE-787 | C/C++ |
/* vi:set ts=8 sts=4 sw=4 noet:
*
* VIM - Vi IMproved by Bram Moolenaar
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
* See README.txt for an overview of the Vim source code.
*/
#include "vim.h"
/*
* Vim originated fro... | cwe | CWE-122 | Python |
#ifndef JSI_LITE_ONLY
#ifndef JSI_AMALGAMATION
#include "jsiInt.h"
#else
char *strptime(const char *buf, const char *fmt, struct tm *tm);
#endif
#include <errno.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <signal.h>
#include <limits.h>
#ifndef __WIN32
#include <sys/wait.h>
#endif
static Jsi_RC consoleInput... | cwe | CWE-120 | C/C++ |
static Image *ReadDDSImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
Image
*image;
MagickBooleanType
status,
cubemap = MagickFalse,
volume = MagickFalse;
CompressionType
compression;
DDSInfo
dds_info;
DDSDecoder
*decoder;
PixelTrait
alpha_trait;
si... | cwe | CWE-20 | C/C++ |
def search_ids
users = Set.new
# 1. exact username matches
if @term.present?
exact_matches = scoped_users.where(username_lower: @term)
# don't pollute mentions with users who haven't shown up in over a year
exact_matches = exact_matches.where('last_seen_at > ?', 1.year.ago) if @topic_id ... | cwe | CWE-200 | Ruby |
/*
* 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-862 | Java |
jas_matrix_t *jas_matrix_create(int numrows, int numcols)
{
jas_matrix_t *matrix;
int i;
if (numrows < 0 || numcols < 0) {
return 0;
}
if (!(matrix = jas_malloc(sizeof(jas_matrix_t)))) {
return 0;
}
matrix->flags_ = 0;
matrix->numrows_ = numrows;
matrix->numcols_ = numcols;
matrix->rows_ = 0;
matrix->m... | cwe | CWE-190 | C/C++ |
static __always_inline int __do_follow_link(struct path *path, struct nameidata *nd)
{
int error;
void *cookie;
struct dentry *dentry = path->dentry;
touch_atime(path->mnt, dentry);
nd_set_link(nd, NULL);
if (path->mnt != nd->path.mnt) {
path_to_nameidata(path, nd);
dget(dentry);
}
mntget(path->mnt);
... | cwe | CWE-20 | C/C++ |
static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
{
zval *id;
xmlDoc *docp = NULL, *newdoc;
dom_object *intern;
dom_doc_propsptr doc_prop;
char *source;
int source_len, refcount, ret;
long options = 0;
htmlParserCtxtPtr ctxt;
id = getThis();
if (zend_parse_parameters(ZEND_NUM_ARGS(... | cwe | CWE-20 | Unknown |
static int parse_status(const char *value)
{
int ret = 0;
char *c;
/* skip a header line */
c = strchr(value, '\n');
if (!c)
return -1;
c++;
while (*c != '\0') {
int port, status, speed, devid;
unsigned long socket;
char lbusid[SYSFS_BUS_ID_SIZE];
struct usbip_imported_device *idev;
char hub[3];
... | cwe | CWE-200 | Unknown |
void ObjectBackedNativeHandler::Router(
const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate();
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Object> data = args.Data().As<v8::Object>();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v... | cwe | CWE-254 | C/C++ |
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-704 | Python |
static void sctp_destroy_sock(struct sock *sk)
{
struct sctp_sock *sp;
pr_debug("%s: sk:%p\n", __func__, sk);
/* Release our hold on the endpoint. */
sp = sctp_sk(sk);
/* This could happen during socket init, thus we bail out
* early, since the rest of the below is not setup either.
*/
if (sp->ep == NULL)
... | cwe | CWE-362 | C/C++ |
package com.seafile.seadroid2.ui.activity;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.ServiceConnection;
import android.database.Cursor;
import android.net.Ur... | cwe | CWE-326 | Java |
unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
unsigned long len, unsigned long pgoff, unsigned long flags)
{
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;
int do_colour_align;
struct vm_unmapped_area_info info;
if (flags & MAP_FIXED) {
/* We do not accept a share... | cwe | CWE-119 | Unknown |
/*
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
| Copyright (c) 1998-2016 Zend Technologies Ltd. (http://www.zend.com) |
+---------... | cwe | CWE-190 | C/C++ |
xfs_ioc_space(
struct file *filp,
xfs_flock64_t *bf)
{
struct inode *inode = file_inode(filp);
struct xfs_inode *ip = XFS_I(inode);
struct iattr iattr;
enum xfs_prealloc_flags flags = XFS_PREALLOC_CLEAR;
uint iolock = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL;
int error;
if (inode->i_flags & (S_IMMUTABLE|S_... | cwe | CWE-125 | Unknown |
static inline void mcryptd_check_internal(struct rtattr **tb, u32 *type,
u32 *mask)
{
struct crypto_attr_type *algt;
algt = crypto_get_attr_type(tb);
if (IS_ERR(algt))
return;
if ((algt->type & CRYPTO_ALG_INTERNAL))
*type |= CRYPTO_ALG_INTERNAL;
if ((algt->mask & CRYPTO_ALG_INTERNAL))
*mask |= CRYPTO... | cwe | CWE-476 | C/C++ |
addUser(hash) {
if (hash.length != 64 || hash.includes(';')) throw 'invalid hash';
this.all(
'SELECT * FROM users',
(err, data) => {
const id = data.length + 1 || 1;
this.run(`INSERT INTO users VALUES(${id}, "${hash}")`);
}
);
... | cwe | CWE-89 | JavaScript |
# -*- coding: utf-8 -*-
# Copyright 2018 New Vector Ltd
#
# 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 la... | cwe | CWE-74 | Python |
/*
* MinIO Cloud Storage, (C) 2015-2020 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicab... | cwe | CWE-285 | Go |
getCacheFile(filename) {
let hash = md5(this.optionsHash + filename);
return path.join(this.dir, hash + '.json');
} | cwe | CWE-200 | JavaScript |
int user_update(struct key *key, struct key_preparsed_payload *prep)
{
struct user_key_payload *upayload, *zap;
size_t datalen = prep->datalen;
int ret;
ret = -EINVAL;
if (datalen <= 0 || datalen > 32767 || !prep->data)
goto error;
/* construct a replacement payload */
ret = -ENOMEM;
upayload = kmalloc(size... | cwe | CWE-264 | C/C++ |
def connectionMade(self):
method = getattr(self.factory, 'method', b'GET')
self.sendCommand(method, self.factory.path)
if self.factory.scheme == b'http' and self.factory.port != 80:
host = self.factory.host + b':' + intToBytes(self.factory.port)
elif self.factory.scheme == b'... | cwe | CWE-74 | Python |
int imap_open_connection(struct ImapAccountData *adata)
{
if (mutt_socket_open(adata->conn) < 0)
return -1;
adata->state = IMAP_CONNECTED;
if (imap_cmd_step(adata) != IMAP_RES_OK)
{
imap_close_connection(adata);
return -1;
}
if (mutt_istr_startswith(adata->buf, "* OK"))
{
if (!mutt_istr... | cwe | CWE-522 | C/C++ |
/**
* 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 |
int res_unpack(vorbis_info_residue *info,
vorbis_info *vi,oggpack_buffer *opb){
int j,k;
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
memset(info,0,sizeof(*info));
info->type=oggpack_read(opb,16);
if(info->type>2 || info->type<0)goto errout;
info->begin=oggpack_read(opb,2... | cwe | CWE-200 | C/C++ |
static Image *ReadPWPImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
char
filename[MaxTextExtent];
FILE
*file;
Image
*image,
*next_image,
*pwp_image;
ImageInfo
*read_info;
int
c,
unique_file;
MagickBooleanType
status;
register Image
*p;
regist... | cwe | CWE-252 | C/C++ |
function updateBasicSettings(PDFStructure &$structure) {
// set headline
if (isset($_POST['headline'])) {
$structure->setTitle(str_replace('<', '', str_replace('>', '', $_POST['headline'])));
}
// set logo
if (isset($_POST['logoFile'])) {
$structure->setLogo($_POST['logoFile']);
}
// set folding marks
if (i... | cwe | CWE-22 | PHP |
int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest,
const URI_TYPE(QueryList) * queryList,
int maxChars, int * charsWritten, int * charsRequired,
UriBool spaceToPlus, UriBool normalizeBreaks) {
UriBool firstItem = URI_TRUE;
int ampersandLen = 0; /* increased to 1 from second item on */
URI_CHAR * write = dest;
... | cwe | CWE-190 | C/C++ |
TfLiteStatus Subgraph::AddNodeWithParameters(
const std::vector<int>& inputs, const std::vector<int>& outputs,
const std::vector<int>& intermediates, const char* init_data,
size_t init_data_size, void* builtin_data,
const TfLiteRegistration* registration, int* node_index) {
std::unique_ptr<void, declt... | cwe | CWE-787 | Unknown |
package config
import (
"net/http"
"github.com/sipcapture/homer-app/model"
"golang.org/x/oauth2"
)
var Setting HomerSettingServer
var OAuth2TokenMap map[string]model.OAuth2MapToken
type HomerSettingServer struct {
MAIN_SETTINGS struct {
IsolateQuery string `default:""`
IsolateGroup string `de... | cwe | CWE-798 | Go |
grub_fshelp_read_file (grub_disk_t disk, grub_fshelp_node_t node,
void (*read_hook) (grub_disk_addr_t sector,
unsigned offset,
unsigned length,
void *closure),
void *closure, int flags,
grub_off_t pos, grub_size_t len, char *buf,
grub_disk_addr_t (*get_block) (gr... | cwe | CWE-787 | C/C++ |
do_ed_script (char const *inname, char const *outname,
bool *outname_needs_removal, FILE *ofp)
{
static char const editor_program[] = EDITOR_PROGRAM;
file_offset beginning_of_this_line;
size_t chars_read;
FILE *tmpfp = 0;
char const *tmpname;
int tmpfd;
pid_t pid;
if (! dry_run ... | cwe | CWE-78 | Unknown |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const auto* params =
reinterpret_cast<TfLiteUnidirectionalSequenceLSTMParams*>(
node->builtin_data);
const OpData* op_data = reinterpret_cast<OpData*>(node->user_data);
const bool is_layer_norm_lstm = op_data->is_layer_norm_lstm;
cons... | cwe | CWE-125 | C/C++ |
ex_retab(exarg_T *eap)
{
linenr_T lnum;
int got_tab = FALSE;
long num_spaces = 0;
long num_tabs;
long len;
long col;
long vcol;
long start_col = 0; // For start of white-space string
long start_vcol = 0; // For start of white-space string
long old_len;
char_u *ptr;
cha... | cwe | CWE-122 | Unknown |
ikev2_n_print(netdissect_options *ndo, u_char tpay _U_,
const struct isakmp_gen *ext,
u_int item_len, const u_char *ep,
uint32_t phase _U_, uint32_t doi _U_,
uint32_t proto _U_, int depth _U_)
{
const struct ikev2_n *p;
struct ikev2_n n;
const u_char *cp;
u_char showspi, showdata, showsomedata;
const char ... | cwe | CWE-835 | C/C++ |
/*
* GPAC - Multimedia Framework C SDK
*
* Authors: Jean Le Feuvre
* Copyright (c) Telecom ParisTech 2000-2023
* All rights reserved
*
* This file is part of GPAC / text import filter
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General P... | cwe | CWE-193 | C/C++ |
public int decryptWithAd(byte[] ad, byte[] ciphertext,
int ciphertextOffset, byte[] plaintext, int plaintextOffset,
int length) throws ShortBufferException, BadPaddingException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (le... | cwe | CWE-787 | Java |
import io
import json
import os
from datetime import datetime
import requests
from cookbook.models import Recipe, RecipeImport, SyncLog
from cookbook.provider.provider import Provider
class Dropbox(Provider):
@staticmethod
def import_all(monitor):
url = "https://api.dropboxapi.com/2/files/list_folde... | cwe | CWE-918 | Python |
Status explain(OperationContext* opCtx,
const OpMsgRequest& request,
ExplainOptions::Verbosity verbosity,
BSONObjBuilder* out) const override {
std::string dbname = request.getDatabase().toString();
const BSONObj& cmdObj = request.body;
//... | cwe | CWE-20 | Unknown |
static int hidp_setup_hid(struct hidp_session *session,
struct hidp_connadd_req *req)
{
struct hid_device *hid;
int err;
session->rd_data = kzalloc(req->rd_size, GFP_KERNEL);
if (!session->rd_data)
return -ENOMEM;
if (copy_from_user(session->rd_data, req->rd_data, req->rd_size)) {
err = -EFAULT;
goto f... | cwe | CWE-200 | C/C++ |
int ext4_ext_insert_extent(handle_t *handle, struct inode *inode,
struct ext4_ext_path *path,
struct ext4_extent *newext, int flag)
{
struct ext4_extent_header *eh;
struct ext4_extent *ex, *fex;
struct ext4_extent *nearex; /* nearest extent */
struct ext4_ext_path *npath = NULL;
int depth, len, err;
ext4_... | cwe | CWE-703 | Unknown |
static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size)
{
AcpiPciHpState *s = opaque;
uint32_t val = 0;
int bsel = s->hotplug_select;
if (bsel < 0 || bsel > ACPI_PCIHP_MAX_HOTPLUG_BUS) {
return 0;
}
switch (addr) {
case PCI_UP_BASE:
val = s->acpi_pcihp_pc... | cwe | CWE-119 | C/C++ |
'use strict'
const fp = require('fastify-plugin')
const compare = require('secure-compare')
function factory (options) {
const defaultOptions = {
keys: [],
auth: undefined,
errorResponse (err) {
return { error: err.message }
},
contentType: undefined,
bearerType: 'Bearer'
}
const _... | cwe | CWE-203 | JavaScript |
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-476 | Python |
function chart_legend_options(item){
if(item.data('series').length == 1) return {show: false};
var options = item.data('legend-options');
switch (options)
{
case "external":
return {show: true,
noColumns:4,
container:"#legendContainer",
labelFormatter: function(label, series) {... | cwe | CWE-79 | JavaScript |
static int dnxhd_find_frame_end(DNXHDParserContext *dctx,
const uint8_t *buf, int buf_size)
{
ParseContext *pc = &dctx->pc;
uint64_t state = pc->state64;
int pic_found = pc->frame_start_found;
int i = 0;
if (!pic_found) {
for (i = 0; i < buf_size; i++) {
... | cwe | CWE-476 | C/C++ |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
const TfLiteTensor* axis_tensor = GetInput(context, node, kAxisTensor);
int axis = GetTensorData<int32_t>(axis_tensor)[0];
const int rank = NumDimensions(input);
if (axis < 0) {
... | cwe | CWE-125 | C/C++ |
DevToolsUI::DevToolsUI(content::WebUI* web_ui)
: WebUIController(web_ui),
bindings_(web_ui->GetWebContents()) {
web_ui->SetBindings(0);
Profile* profile = Profile::FromWebUI(web_ui);
content::URLDataSource::Add(
profile,
new DevToolsDataSource(profile->GetRequestContext()));
} | cwe | CWE-200 | C/C++ |
void *_zend_shared_memdup(void *source, size_t size, zend_bool free_source)
{
void *old_p, *retval;
if ((old_p = zend_hash_index_find_ptr(&xlat_table, (zend_ulong)source)) != NULL) {
/* we already duplicated this pointer */
return old_p;
}
retval = ZCG(mem);
ZCG(mem) = (void*)(((char*)ZCG(mem)) ... | cwe | CWE-416 | C/C++ |
RequestHandler::RequestHandler(
std::shared_ptr<CheckWorkflow> check_workflow,
std::shared_ptr<context::ServiceContext> service_context,
std::unique_ptr<Request> request_data)
: context_(new context::RequestContext(service_context,
std::move(request_data))),
... | cwe | CWE-290 | C/C++ |
struct dst_entry *inet6_csk_route_req(const struct sock *sk,
struct flowi6 *fl6,
const struct request_sock *req,
u8 proto)
{
struct inet_request_sock *ireq = inet_rsk(req);
const struct ipv6_pinfo *np = inet6_sk(sk);
struct in6_addr *final_p, final;
struct dst_entry *dst;
memset(fl6,... | cwe | CWE-264 | C/C++ |
bool CopyDirectory(const FilePath& from_path,
const FilePath& to_path,
bool recursive) {
base::ThreadRestrictions::AssertIOAllowed();
DCHECK(to_path.value().find('*') == std::string::npos);
DCHECK(from_path.value().find('*') == std::string::npos);
char top_dir[PATH_MAX];
... | cwe | CWE-22 | C/C++ |
/*
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
| Copyright (c) 1998-2016 Zend Technologies Ltd. (http://www.zend.com) |
+---------... | cwe | CWE-190 | C/C++ |
private Template getClassloaderTemplate(ClassLoader classloader, String suffixPath, String templateName)
{
String templatePath = suffixPath + templateName;
URL url = classloader.getResource(templatePath);
return url != null ? new ClassloaderTemplate(new ClassloaderResource(url, templateNam... | cwe | CWE-22 | Java |
private final void servlet31(HttpServletRequest request) {
try {
for(Part part:request.getParts()) {
if(part.getContentType() != null && (StringHelper.containsNonWhitespace(part.getSubmittedFileName()) || !part.getContentType().startsWith("text/plain"))) {
contentType = part.getContentType();
filenam... | cwe | CWE-22 | Java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.