code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
static void rpza_decode_stream(RpzaContext *s)
{
int width = s->avctx->width;
int stride = s->frame.linesize[0] / 2;
int row_inc = stride - 4;
int stream_ptr = 0;
int chunk_size;
unsigned char opcode;
int n_blocks;
unsigned short colorA = 0, colorB;
unsigned short color4[4];
unsi... | cwe | CWE-119 | C/C++ |
static MagickBooleanType WritePDBImage(const ImageInfo *image_info,Image *image,
ExceptionInfo *exception)
{
const char
*comment;
int
bits;
MagickBooleanType
status;
PDBImage
pdb_image;
PDBInfo
pdb_info;
QuantumInfo
*quantum_info;
register const Quantum
*p;
register ... | cwe | CWE-772 | C/C++ |
void Compute(OpKernelContext* c) override {
const Tensor& tag = c->input(0);
OP_REQUIRES(c, TensorShapeUtils::IsScalar(tag.shape()),
errors::InvalidArgument("tag must be scalar"));
const Tensor& tensor = c->input(1);
const Tensor& serialized_summary_metadata_tensor = c->input(2);
Su... | cwe | CWE-703 | Unknown |
idna_to_ascii_4i (const uint32_t * in, size_t inlen, char *out, int flags)
{
size_t len, outlen;
uint32_t *src; /* XXX don't need to copy data? */
int rc;
/*
* ToASCII consists of the following steps:
*
* 1. If all code points in the sequence are in the ASCII range (0..7F)
* then skip to step 3.
... | cwe | CWE-125 | Unknown |
/*
* (c) Copyright Ascensio System SIA 2010-2019
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its ... | cwe | CWE-787 | C/C++ |
requestResetPassword(req) {
const config = req.config;
if (!config) {
this.invalidRequest();
}
if (!config.publicServerURL) {
return this.missingPublicServerURL();
}
const { username, token } = req.query;
if (!username || !token) {
return this.invalidLink(req);
}
... | cwe | CWE-285 | JavaScript |
constructor(container, items, groups, options) {
super()
this.initTime = new Date();
this.itemsDone = false;
if (!(this instanceof Timeline)) {
throw new SyntaxError('Constructor must be called with the new operator');
}
// if the third element is options, the forth is groups (optionally... | cwe | CWE-79 | JavaScript |
def config_basic(request):
form = BasicConfigForm(data=post_data(request))
if is_post(request) and form.is_valid():
form.save()
messages.info(request, _("Settings updated!"))
return redirect(request.GET.get("next", request.get_full_path()))
return render(
request=request,
... | cwe | CWE-601 | Python |
void blk_cleanup_queue(struct request_queue *q)
{
/* mark @q DYING, no new request or merges will be allowed afterwards */
mutex_lock(&q->sysfs_lock);
blk_set_queue_dying(q);
blk_queue_flag_set(QUEUE_FLAG_NOMERGES, q);
blk_queue_flag_set(QUEUE_FLAG_NOXMERGES, q);
blk_queue_flag_set(QUEUE_FLAG_DYING, q);
mutex_u... | cwe | CWE-416 | C/C++ |
BGD_DECLARE(void *) gdImageWBMPPtr(gdImagePtr im, int *size, int fg)
{
void *rv;
gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
if (out == NULL) return NULL;
gdImageWBMPCtx(im, fg, out);
rv = gdDPExtractData(out, size);
out->gd_free(out);
return rv;
} | cwe | CWE-415 | Unknown |
main(int argc, char *argv[])
{
int i, fd, swapped, pkthdrlen, ret, optct, backwards, caplentoobig;
struct pcap_file_header pcap_fh;
struct pcap_pkthdr pcap_ph;
struct pcap_sf_patched_pkthdr pcap_patched_ph; /* Kuznetzov */
char buf[10000];
struct stat statinfo;
uint64_t pktcnt;
uint32_t ... | cwe | CWE-119 | C/C++ |
SProcXIBarrierReleasePointer(ClientPtr client)
{
xXIBarrierReleasePointerInfo *info;
REQUEST(xXIBarrierReleasePointerReq);
int i;
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXIBarrierReleasePointerReq);
swapl(&stuff->num_barriers);
REQUEST_FIXED_SIZE(xXIBarrierReleasePointerReq, stuf... | cwe | CWE-190 | Unknown |
// app.js
'use strict';
var $ = require('jquery');
var Backbone = require('backbone');
Backbone.$ = $;
var Marionette = require('backbone.marionette');
var Radio = require('backbone.radio');
if (window.__agent) {
window.__agent.start(Backbone, Marionette);
}
var LayoutView = require('./views/layout.js');
var router ... | cwe | CWE-284 | JavaScript |
TfLiteStatus CheckInputTensorDimensions(TfLiteContext* context,
TfLiteNode* node, int n_input,
int n_output, int n_cell,
bool use_layer_norm, bool is_integer) {
const auto* params = static_cast<TfLi... | cwe | CWE-787 | C/C++ |
static Image *ReadXPMImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
char
*grey,
key[MaxTextExtent],
target[MaxTextExtent],
*xpm_buffer;
Image
*image;
MagickBooleanType
active,
status;
register char
*next,
*p,
*q;
register IndexPacket
*indexes;
... | cwe | CWE-787 | C/C++ |
function message() {
extend(UserControls, 'userControls', function (items, user) {
if (
app.session.user &&
app.session.user.id() !== user.id() &&
app.forum.attribute('canStartPrivateDiscussion') &&
(user.blocksPd() === false || (app.forum.attribute('canStartPrivateDiscussionWithBlockers')... | cwe | CWE-863 | JavaScript |
void PaymentRequest::Init(mojom::PaymentRequestClientPtr client,
std::vector<mojom::PaymentMethodDataPtr> method_data,
mojom::PaymentDetailsPtr details,
mojom::PaymentOptionsPtr options) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);... | cwe | CWE-189 | C/C++ |
static int ttusbdecfe_dvbs_diseqc_send_master_cmd(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd *cmd)
{
struct ttusbdecfe_state* state = (struct ttusbdecfe_state*) fe->demodulator_priv;
u8 b[] = { 0x00, 0xff, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00 };
memcpy(&b[4], cmd->msg, cmd->msg_le... | cwe | CWE-119 | C/C++ |
package holepunch
import (
"context"
"errors"
"fmt"
"sync"
"time"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/protocol"
pb "github.com/libp2p/go-libp2p/p2p/protocol/holepunch/pb"
"github.com/lib... | cwe | CWE-400 | Go |
var exec = require('child_process').exec;
var regexRegex = /[-\/\\^$*+?.()|[\]{}]/g;
function escape(string) {
return string.replace(regexRegex, '\\$&');
}
module.exports = function (iface, callback) {
exec("ipconfig /all", function (err, out) {
if (err) {
callback(err, null);
... | cwe | CWE-77 | Java |
static int x509parse_verify_child(
x509_cert *child, x509_cert *parent, x509_cert *trust_ca,
x509_crl *ca_crl, int path_cnt, int *flags,
int (*f_vrfy)(void *, x509_cert *, int, int *),
void *p_vrfy )
{
int hash_id, ret;
int parent_flags = 0;
un... | cwe | CWE-310 | Unknown |
static int originates_from_local_legacy_unicast_socket(AvahiServer *s, const AvahiAddress *address, uint16_t port) {
assert(s);
assert(address);
assert(port > 0);
if (!s->config.enable_reflector)
return 0;
if (!avahi_address_is_local(s->monitor, address))
return 0;
if (address... | cwe | CWE-399 | Unknown |
/* radare - LGPL - Copyright 2008-2022 - nibble, pancake, alvaro_fe */
#define R_LOG_ORIGIN "elf"
#include <r_types.h>
#include <r_util.h>
#include "elf.h"
#define MIPS_PLT_OFFSET 0x20
#define RISCV_PLT_OFFSET 0x20
#define LOONGARCH_PLT_OFFSET 0x20
#define RISCV_PLT_ENTRY_SIZE 0x10
#define LOONGARCH_PLT_ENTRY_SIZE 0... | cwe | CWE-787 | C/C++ |
int sandbox(void* sandbox_arg) {
// Get rid of unused parameter warning
(void)sandbox_arg;
pid_t child_pid = getpid();
if (arg_debug)
printf("Initializing child process\n");
// close each end of the unused pipes
close(parent_to_child_fds[1]);
close(child_to_parent_fds[0]);
// wait for parent to do base... | cwe | CWE-732 | Unknown |
package v0
import (
"context"
"errors"
"fmt"
"regexp"
"sort"
"strconv"
"strings"
v0 "github.com/authzed/authzed-go/proto/authzed/api/v0"
"github.com/authzed/grpcutil"
"github.com/google/go-cmp/cmp"
"github.com/rs/zerolog/log"
"google.golang.org/grpc"
"google.golang.org/protobuf/encoding/prototext"
v1 "... | cwe | CWE-20 | Go |
int main(void)
{
int fd, len, sock_opt;
int error;
struct cn_msg *message;
struct pollfd pfd;
struct nlmsghdr *incoming_msg;
struct cn_msg *incoming_cn_msg;
struct hv_kvp_msg *hv_msg;
char *p;
char *key_value;
char *key_name;
daemon(1, 0);
openlog("KVP", 0, LOG_USER);
syslog(LOG_INFO, "KVP starting; pid i... | cwe | CWE-20 | C/C++ |
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package net
import (
"context"
"internal/nettrace"
"internal/singleflight"
"sync"
)
// protocols contains minimal mappings between internet protocol
// na... | cwe | CWE-74 | Go |
aa&&(la=pa[ca],null==la&&(la={},pa[ca]=la),ca=la[aa],null==ca&&(ca=[],la[aa]=ca),ca.push(na))}ia=ia.nextSibling}G(ya,fa,wa)}})}function I(ia){v&&(Aa.scrollTop=0,ea.innerHTML="",Ha.spin(ea),U=!1,V=!0,ha.innerHTML=mxUtils.htmlEntities(mxResources.get("recentDiag")),ba=null,v(ua,function(){z(mxResources.get("cannotLoad"))... | cwe | CWE-94 | JavaScript |
/* $Id$ */
/*
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.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; eit... | cwe | CWE-835 | C/C++ |
import os
import subprocess
import logging
import time
import argparse
import datetime
from traitlets import Integer, default
from traitlets.config import Configurable
from functools import partial
def execute_cmd(cmd, **kwargs):
"""
Call given command, yielding output line by line
"""
yield '$ {}\n'.... | cwe | CWE-94 | Python |
ecma_op_internal_buffer_append (ecma_collection_t *container_p, /**< internal container pointer */
ecma_value_t key_arg, /**< key argument */
ecma_value_t value_arg, /**< value argument */
lit_magic_string_id_t lit_id) /**< ... | cwe | CWE-703 | Unknown |
/** @file index.c
* @brief Functions to parse index records
*
* Copyright (c) 2020 Bartek Fabiszewski
* http://www.fabiszewski.net
*
* This file is part of libmobi.
* Licensed under LGPL, either version 3, or any later.
* See <http://www.gnu.org/licenses/>
*/
#define _GNU_SOURCE 1
#ifndef __USE_BSD
#define _... | cwe | CWE-476 | C/C++ |
function wrapmessage(title, message, count, ago, persistent) {
let html = '<hr><p><b>' + title + '</b></p><p class="adminNotifyMessage">' + message + '</p>';
let additional = '';
if (count > 1) additional += client.translate('Event repeated %1 times.', count) + ' ';
let units = client.translate('minut... | cwe | CWE-79 | JavaScript |
PHP_FUNCTION(hash_update_file)
{
zval *zhash, *zcontext = NULL;
php_hash_data *hash;
php_stream_context *context;
php_stream *stream;
char *filename, buf[1024];
int filename_len, n;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|r", &zhash, &filename, &filename_len, &zcontext) == FAILURE) {
return;
... | cwe | CWE-20 | Unknown |
/*
Copyright 2019 The Vitess 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, soft... | cwe | CWE-20 | Go |
ma);H.moveCells(ma,N,W)},!0,u);u=null}else if("organic"==P||"auto"==P&&ma.length>y.length){H.view.validate();var wa=new mxFastOrganicLayout(H);wa.forceConstant=3*fa;wa.disableEdgeStyle=!1;wa.resetEdges=!1;var Ea=wa.isVertexIgnored;wa.isVertexIgnored=function(Da){return Ea.apply(this,arguments)||0>mxUtils.indexOf(y,Da)}... | cwe | CWE-20 | JavaScript |
static int net_ctl_permissions(struct ctl_table_header *head,
struct ctl_table *table)
{
struct net *net = container_of(head->set, struct net, sysctls);
kuid_t root_uid = make_kuid(net->user_ns, 0);
kgid_t root_gid = make_kgid(net->user_ns, 0);
/* Allow network administrator to have same access as root. ... | cwe | CWE-20 | 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-369 | Python |
function inetChecksite(url, callback) {
return new Promise((resolve) => {
process.nextTick(() => {
let result = {
url: url,
ok: false,
status: 404,
ms: null
};
if (typeof url !== 'string') {
if (callback) { callback(result); }
return resolve(resul... | cwe | CWE-20 | JavaScript |
ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
isc_result_t result;
dns_name_t *question_name;
dns_rdataset_t *question_rdataset;
dns_zone_t *zone = NULL, *raw = NULL, *mayberaw;
dns_db_t *db = NULL;
dns_dbversion_t *ver = NULL;
dns_rdataclass_t question_class;
rrstream_t *soa_stream = NULL;
rrst... | cwe | CWE-732 | Unknown |
static void start_daemon()
{
// Capture USB device if not in no-printer mode
struct usb_sock_t *usb_sock;
if (g_options.noprinter_mode == 0) {
usb_sock = usb_open();
if (usb_sock == NULL)
goto cleanup_usb;
} else
usb_sock = NULL;
// Capture a socket
uint16_t desired_port = g_options.desired_port;
struc... | cwe | CWE-264 | C/C++ |
static void rfbProcessClientNormalMessage(rfbClientPtr cl)
{
int n;
rfbClientToServerMsg msg;
char *str;
READ((char *)&msg, 1)
switch (msg.type) {
case rfbSetPixelFormat:
READ(((char *)&msg) + 1, sz_rfbSetPixelFormatMsg - 1)
cl->format.bitsPerPixel = msg.spf.format.bitsPerPixel;
cl-... | cwe | CWE-787 | Unknown |
void PrintViewManager::PrintPreviewDone() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK_NE(NOT_PREVIEWING, print_preview_state_);
if (print_preview_state_ == SCRIPTED_PREVIEW) {
auto& map = g_scripted_print_preview_closure_map.Get();
auto it = map.find(scripted_print_preview_rph_);
CHECK(it !=... | cwe | CWE-416 | C/C++ |
WORD32 ih264d_parse_sei_message(dec_struct_t *ps_dec,
dec_bit_stream_t *ps_bitstrm)
{
UWORD32 ui4_payload_type, ui4_payload_size;
UWORD32 u4_bits;
WORD32 i4_status = 0;
do
{
ui4_payload_type = 0;
u4_bits = ih264d_get_bits_h264(ps_bitstrm, 8);
while(0xff == u4_bits)
... | cwe | CWE-200 | C/C++ |
PHPAPI php_url *php_url_parse_ex(char const *str, int length)
{
char port_buf[6];
php_url *ret = ecalloc(1, sizeof(php_url));
char const *s, *e, *p, *pp, *ue;
s = str;
ue = s + length;
/* parse scheme */
if ((e = memchr(s, ':', length)) && (e - s)) {
/* validate scheme */
p = s;
while (p < e) {
/* sch... | cwe | CWE-20 | C/C++ |
$(function () {
function UserSettingsViewModel(parameters) {
var self = this;
self.loginState = parameters[0];
self.access = parameters[1];
self.users = self.access.users;
self.userSettingsDialog = undefined;
var auto_locale = {
language: "_default",
... | cwe | CWE-613 | Python |
TPMI_ALG_KEYEDHASH_SCHEME_Unmarshal(TPMI_ALG_KEYEDHASH_SCHEME *target, BYTE **buffer, INT32 *size, BOOL allowNull)
{
TPM_RC rc = TPM_RC_SUCCESS;
if (rc == TPM_RC_SUCCESS) {
rc = TPM_ALG_ID_Unmarshal(target, buffer, size);
}
if (rc == TPM_RC_SUCCESS) {
switch (*target) {
#if ALG_HMAC
case TPM_ALG... | cwe | CWE-787 | Unknown |
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;
int interlaced = dctx->interlaced;
int cur_field = dctx->cur... | cwe | CWE-476 | C/C++ |
public function get() {
$r = '<div class="title gallery_div">'.$this->stack_name.'</div>';
for ($i = 0; $i < count($this->tiles_array); $i++) {
$top = rand(-5, 5);
$left = rand(-5, 5);
$img_w = $this->tiles_array[$i]->getWidth();
$extra = '';
if ($img_w < IMAGE_WIDTH) {
$extra = 'width:'.$img_w.'... | cwe | CWE-79 | PHP |
goa_http_client_check (GoaHttpClient *client,
const gchar *uri,
const gchar *username,
const gchar *password,
gboolean accept_ssl_errors,
GCancellable *canc... | cwe | CWE-310 | Unknown |
protected function _afterLoad()
{
if ($this->_addUrlRewrite) {
$this->_addUrlRewrite($this->_urlRewriteCategory);
}
if (count($this) > 0) {
Mage::dispatchEvent('catalog_product_collection_load_after', array('collection' => $this));
}
foreach ($this a... | cwe | CWE-502 | PHP |
exports.getBlockInfo = function(options,callback) {
// Need to be able to look up a drive's position in the array to
// be able to add partitions to the drive
var devMap = {};
if (options.ignoredev) {
var ignoreexp = new RegExp(options.ignoredev);
}
// Are we ignoring any dev majors?
var ignoremajor... | cwe | CWE-78 | JavaScript |
urlParams.sketch?3:48)));this.getX()==V&&this.getY()==X||mxWindow.prototype.setLocation.apply(this,arguments)};var W=mxUtils.bind(this,function(){var V=this.window.getX(),X=this.window.getY();this.window.setLocation(V,X)});mxEvent.addListener(window,"resize",W);this.destroy=function(){mxEvent.removeListener(window,"res... | cwe | CWE-20 | JavaScript |
package io.hawt.web.auth;
import java.io.IOException;
import java.io.PrintWriter;
import java.security.Principal;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.security.auth.Subject;
import javax.servlet.ServletExcept... | cwe | CWE-918 | Java |
!1)?!1:q}if(q||this.isOffline()){v.href=URL.createObjectURL(k?this.base64ToBlob(c,g):new Blob([c],{type:g}));q?v.download=e:v.setAttribute("target","_blank");document.body.appendChild(v);try{window.setTimeout(function(){URL.revokeObjectURL(v.href)},2E4),v.click(),v.parentNode.removeChild(v)}catch(A){}}else this.createE... | cwe | CWE-20 | JavaScript |
int ssl3_get_client_hello(SSL *s)
{
int i, j, ok, al, ret = -1, cookie_valid = 0;
unsigned int cookie_len;
long n;
unsigned long id;
unsigned char *p, *d, *q;
SSL_CIPHER *c;
#ifndef OPENSSL_NO_COMP
SSL_COMP *comp = NULL;
#endif
STACK_OF(SSL_CIPHER) *ciphers = NULL;
/*
* We do t... | cwe | CWE-190 | Unknown |
mesalink_connect_step3(struct connectdata *conn, int sockindex)
{
CURLcode result = CURLE_OK;
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
#ifdef MESALINK_HAVE_SESSION
if(SSL_SET_OPTION(primary.sessionid)) {
bool incache;
SSL_SESSIO... | cwe | CWE-290 | Unknown |
/*
* This file includes functions to transform a concrete syntax tree (CST) to
* an abstract syntax tree (AST). The main function is Ta27AST_FromNode().
*
*/
#include "Python.h"
#include "Python-ast.h"
#include "grammar.h"
#include "node.h"
#include "pyarena.h"
#include "ast.h"
#include "token.h"
#include "parseto... | cwe | CWE-125 | Python |
static int cac_cac1_get_certificate(sc_card_t *card, u8 **out_buf, size_t *out_len)
{
u8 buf[CAC_MAX_SIZE];
u8 *out_ptr;
size_t size = 0;
size_t left = 0;
size_t len, next_len;
sc_apdu_t apdu;
int r = SC_SUCCESS;
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);
/* get the size */
size = left = *out_buf ? *out... | cwe | CWE-119 | C/C++ |
static void *__alloc_from_pool(size_t size, struct page **ret_page, gfp_t flags)
{
unsigned long val;
void *ptr = NULL;
if (!atomic_pool) {
WARN(1, "coherent pool not initialised!\n");
return NULL;
}
val = gen_pool_alloc(atomic_pool, size);
if (val) {
phys_addr_t phys = gen_pool_virt_to_phys(atomic_pool, ... | cwe | CWE-200 | C/C++ |
static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
u32 val, ktime_t *abs_time, u32 bitset,
u32 __user *uaddr2)
{
struct hrtimer_sleeper timeout, *to = NULL;
struct rt_mutex_waiter rt_waiter;
struct rt_mutex *pi_mutex = NULL;
struct futex_hash_bucket *hb;
union futex_key key2 = FUTEX_... | cwe | CWE-269 | C/C++ |
/*
* Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy,... | cwe | CWE-287 | Java |
void UTFstring::UpdateFromUTF8()
{
delete [] _Data;
// find the size of the final UCS-2 string
size_t i;
for (_Length=0, i=0; i<UTF8string.length(); _Length++) {
uint8 lead = static_cast<uint8>(UTF8string[i]);
if (lead < 0x80)
i++;
else if ((lead >> 5) == 0x6)
i += 2;
else if ((lead ... | cwe | CWE-200 | C/C++ |
var http = require('http');
var querystring = require('querystring');
var errorTemplate = require('../templates/error.js');
const snip = require('../snip.js');
const genReqLogLine = ({ head, method, path, params, suffix }) =>
!process.appParams.color
? [
head,
method,
path[0] + (path.leng... | cwe | CWE-285 | JavaScript |
psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
{ sf_count_t total = 0 ;
ssize_t count ;
DWORD dwNumberOfBytesWritten ;
if (psf->virtual_io)
return psf->vio.write (ptr, bytes * items, psf->vio_user_data) / bytes ;
items *= bytes ;
/* Do this check after the multiplication abo... | cwe | CWE-189 | Unknown |
void get_checksum2(char *buf, int32 len, char *sum)
{
md_context m;
switch (xfersum_type) {
case CSUM_MD5: {
uchar seedbuf[4];
md5_begin(&m);
if (proper_seed_order) {
if (checksum_seed) {
SIVALu(seedbuf, 0, checksum_seed);
md5_update(&m, seedbuf, 4);
}
md5_update(&m, (uchar *)buf, len);
}... | cwe | CWE-354 | Unknown |
func (p *BinaryProtocol) ReadBinary() ([]byte, error) {
size, e := p.ReadI32()
if e != nil {
return nil, e
}
if size < 0 {
return nil, invalidDataLength
}
if uint64(size) > p.trans.RemainingBytes() {
return nil, invalidDataLength
}
isize := int(size)
buf := make([]byte, isize)
_, err := io.ReadFull(p.t... | cwe | CWE-770 | Go |
#
# 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 not... | cwe | CWE-20 | Python |
static void tw5864_handle_frame(struct tw5864_h264_frame *frame)
{
#define SKIP_VLCBUF_BYTES 3
struct tw5864_input *input = frame->input;
struct tw5864_dev *dev = input->root;
struct tw5864_buf *vb;
struct vb2_v4l2_buffer *v4l2_buf;
int frame_len = frame->vlc_len - SKIP_VLCBUF_BYTES;
u8 *dst = input->buf_cur_ptr;... | cwe | CWE-476 | C/C++ |
static void _cmd_window_show_opt(const char *data, int right)
{
MAIN_WINDOW_REC *parent;
WINDOW_REC *window;
if (*data == '\0') cmd_return_error(CMDERR_NOT_ENOUGH_PARAMS);
if (is_numeric(data, '\0')) {
window = window_find_refnum(atoi(data));
if (window == NULL) {
printformat_window(active_win, MSGLEVEL_CL... | cwe | CWE-476 | C/C++ |
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <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 the
* <a href="http://www.apache... | cwe | CWE-91 | Java |
/* $OpenBSD: doas.c,v 1.57 2016/06/19 19:29:43 martijn Exp $ */
/*
* Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice app... | cwe | CWE-908 | C/C++ |
package com.salesmanager.shop.admin.controller.products;
import com.salesmanager.core.business.services.catalog.product.attribute.ProductOptionService;
import com.salesmanager.core.business.services.reference.language.LanguageService;
import com.salesmanager.core.business.utils.ajax.AjaxResponse;
import com.salesmanag... | cwe | CWE-79 | Java |
public function download(){
$this->checkLogin();
$this->checkAdmin();
set_time_limit(1000);
ini_set('memory_limit','500M');
$new_version = I("new_version") ;
$file_url = I("file_url") ;
$version_num = str_replace("v","",$new_version) ;
$showdoc_path = "..... | cwe | CWE-434 | PHP |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
auto* params = reinterpret_cast<TfLiteSequenceRNNParams*>(node->builtin_data);
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
const TfLiteTensor* input_weights = GetInput(context, node, kWeightsTensor);
const TfLiteTensor* recurre... | cwe | CWE-787 | C/C++ |
nfsd4_encode_layoutget(struct nfsd4_compoundres *resp, __be32 nfserr,
struct nfsd4_layoutget *lgp)
{
struct xdr_stream *xdr = &resp->xdr;
const struct nfsd4_layout_ops *ops =
nfsd4_layout_ops[lgp->lg_layout_type];
__be32 *p;
dprintk("%s: err %d\n", __func__, nfserr);
if (nfserr)
goto out;
nfserr = nfserr_... | cwe | CWE-20 | Unknown |
CURLcode Curl_ntlm_core_mk_nt_hash(struct Curl_easy *data,
const char *password,
unsigned char *ntbuffer /* 21 bytes */)
{
size_t len = strlen(password);
unsigned char *pw = len ? malloc(len * 2) : strdup("");
CURLcode result;
if(!pw)
ret... | cwe | CWE-190 | C/C++ |
/*
* mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
* Copyright (c) 2008, Jouni Malinen <j@w1.fi>
* Copyright (c) 2011, Javier Lopez <jlopex@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
... | cwe | CWE-400 | C/C++ |
/*
* 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-190 | C/C++ |
package api
import (
"fmt"
)
// Role is the type of a role.
type Role string
const (
// Host is the HOST role.
Host Role = "HOST"
// Admin is the ADMIN role.
Admin Role = "ADMIN"
// NormalUser is the USER role.
NormalUser Role = "USER"
)
func (e Role) String() string {
switch e {
case Host:
return "HOST"... | cwe | CWE-284 | Go |
Jsi_Value* jsi_ValueSubscript(Jsi_Interp *interp, Jsi_Value *target, Jsi_Value *key, Jsi_Value **ret)
{
int len;
Jsi_ValueReset(interp, ret);
Jsi_Value *v = jsi_ValueLookupBase(interp, target, key, ret);
if (v)
return v;
const char *keyStr = Jsi_ValueString(interp, key, NULL);
if (!keySt... | cwe | CWE-120 | C/C++ |
module_free_common(struct lys_module *module, void (*private_destructor)(const struct lys_node *node, void *priv))
{
struct ly_ctx *ctx;
struct lys_node *next, *iter;
unsigned int i;
assert(module->ctx);
ctx = module->ctx;
/* just free the import array, imported modules will stay in the contex... | cwe | CWE-617 | Unknown |
protected function connect() {
if ($this->connection and $this->connection->isValid()) {
return;
}
$command = sprintf('%s --authentication-file=/proc/self/fd/3 //%s/%s',
Server::CLIENT,
$this->server->getHost(),
$this->name
);
$this->connection = new Connection($command);
$this->connection->writ... | cwe | CWE-78 | PHP |
/*!
* URI.js - Mutating URLs
*
* Version: 1.19.3
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/
(function (root, factory) {
'use strict';
// https://github.com/umdjs/umd/blob/master/returnExports.js
... | cwe | CWE-20 | JavaScript |
define([
'../res/widgetTemplate.html',
'./Rule',
'./ConditionManager',
'./TestDataManager',
'./WidgetDnD',
'./eventHelpers',
'objectUtils',
'lodash',
'zepto',
'@braintree/sanitize-url'
], function (
widgetTemplate,
Rule,
ConditionManager,
TestDataManager,
Widg... | cwe | CWE-79 | JavaScript |
do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
{
#ifdef CONFIG_X86_MCE
/* notify userspace of pending MCEs */
if (thread_info_flags & _TIF_MCE_NOTIFY)
mce_notify_process();
#endif /* CONFIG_X86_64 && CONFIG_X86_MCE */
/* deal with pending signal delivery */
if (thread_info_flags & ... | cwe | CWE-400 | Unknown |
def add_language(lang):
try:
cur.execute(f"INSERT INTO language (name) VALUES ('{lang}')")
except Exception as e:
pass
cur.execute(f"SELECT language_id FROM language where name='{lang}'")
lang_id = cur.fetchone()[0]
if conn.commit():
return lang_id
return lang_id | cwe | CWE-89 | Python |
/* vips7 compat stub for vips_dzsave()
*
* 11/6/13
* - from im_vips2tiff()
*/
/*
This file is part of VIPS.
VIPS 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 ... | cwe | CWE-908 | C/C++ |
static int ossl_init(void)
{
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && \
!defined(LIBRESSL_VERSION_NUMBER)
const uint64_t flags =
#ifdef OPENSSL_INIT_ENGINE_ALL_BUILTIN
/* not present in BoringSSL */
OPENSSL_INIT_ENGINE_ALL_BUILTIN |
#endif
#ifdef CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG
OPENSSL_INIT... | cwe | CWE-290 | Unknown |
_forceinline void Unpack::InsertOldDist(uint Distance)
{
OldDist[3]=OldDist[2];
OldDist[2]=OldDist[1];
OldDist[1]=OldDist[0];
OldDist[0]=Distance;
}
#ifdef _MSC_VER
#define FAST_MEMCPY
#endif
_forceinline void Unpack::CopyString(uint Length,uint Distance)
{
size_t SrcPtr=UnpPtr-Distance;
if (SrcPtr<MaxWin... | cwe | CWE-787 | C/C++ |
static int dtls1_preprocess_fragment(SSL *s, struct hm_header_st *msg_hdr)
{
size_t frag_off, frag_len, msg_len;
msg_len = msg_hdr->msg_len;
frag_off = msg_hdr->frag_off;
frag_len = msg_hdr->frag_len;
/* sanity checking */
if ((frag_off + frag_len) > msg_len) {
SSLerr(SSL_F_DTLS1_PREPR... | cwe | CWE-399 | Unknown |
package unzip
import (
"archive/zip"
"os"
"path/filepath"
"io"
"fmt"
)
type Unzip struct {
Src string
Dest string
}
func New(src string, dest string) Unzip {
return Unzip{src, dest}
}
func (uz Unzip) Extract() error {
fmt.Println("Extraction of " + uz.Src + " started!")
r, err := zip.OpenReader(uz.Src)
... | cwe | CWE-22 | Go |
TfLiteStatus PopulatePrecomputedZPTimesWeightsWithBias(TfLiteContext* context,
OpData* op_data,
TfLiteNode* node) {
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
const TfLiteTensor* out... | cwe | CWE-125 | 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 |
def login(database, username, password)
auth[database.to_s] = [username, password]
end | cwe | CWE-20 | Ruby |
/* $OpenBSD: x509_vfy.c,v 1.97 2021/11/13 18:24:45 schwarze Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* Th... | cwe | CWE-295 | C/C++ |
static int b_unpack (lua_State *L) {
Header h;
const char *fmt = luaL_checkstring(L, 1);
size_t ld;
const char *data = luaL_checklstring(L, 2, &ld);
size_t pos = luaL_optinteger(L, 3, 1) - 1;
defaultoptions(&h);
lua_settop(L, 2);
while (*fmt) {
int opt = *fmt++;
size_t size = optsize(L, opt, &fm... | cwe | CWE-190 | C/C++ |
static Image *ReadXWDImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
#define CheckOverflowException(length,width,height) \
(((height) != 0) && ((length)/((size_t) height) != ((size_t) width)))
char
*comment;
Image
*image;
IndexPacket
index;
int
x_status;
MagickBooleanType
... | cwe | CWE-369 | C/C++ |
bool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *catalog, Object *str,
const double *ptm, int paintType, int /*tilingType*/, Dict *resDict,
const double *mat, const double *bbox,
int x0, int y0, int x1, int y1,
double xStep, double yStep)
{
PDFRectangle box;
Gfx *gfx;... | cwe | CWE-369 | Unknown |
void Part::slotOpenExtractedEntry(KJob *job)
{
if (!job->error()) {
OpenJob *openJob = qobject_cast<OpenJob*>(job);
Q_ASSERT(openJob);
m_tmpExtractDirList << openJob->tempDir();
const QString fullName = openJob->validatedFilePath();
bool isWritable = m_model->archive() &&... | cwe | CWE-78 | Unknown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.