code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
/*
* Monkey's Audio lossless audio decoder
* Copyright (c) 2007 Benjamin Zores <ben@geexbox.org>
* based upon libdemac from Dave Chapman.
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as publi... | cwe | CWE-125 | C/C++ |
it "can set password" do
user = InviteRedeemer.new(invite: invite, email: invite.email, username: username, name: name, password: password).redeem
expect(user).to have_password
expect(user.confirm_password?(password)).to eq(true)
expect(user.approved).to eq(true)
end | cwe | CWE-285 | Ruby |
BrowserContextDestroyer::BrowserContextDestroyer(
BrowserContext* context,
const std::set<content::RenderProcessHost*>& hosts)
: context_(context),
pending_hosts_(0) {
for (std::set<content::RenderProcessHost*>::iterator it = hosts.begin();
it != hosts.end(); ++it) {
(*it)->AddObserver(th... | cwe | CWE-20 | C/C++ |
cmdline_erase_chars(
int c,
int indent
#ifdef FEAT_SEARCH_EXTRA
, incsearch_state_T *isp
#endif
)
{
int i;
int j;
if (c == K_KDEL)
c = K_DEL;
/*
* Delete current character is the same as backspace on next
* character, except at end of line.
*/
if (c == K_DEL && ccline.cmdpos ... | cwe | CWE-787 | C/C++ |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
OpData* data = static_cast<OpData*>(node->user_data);
TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* input = GetInput(context, node, 0);
TfLiteTensor* output = GetOutput(cont... | cwe | CWE-125 | C/C++ |
status_t OMXCodec::configureCodec(const sp<MetaData> &meta) {
ALOGV("configureCodec protected=%d",
(mFlags & kEnableGrallocUsageProtected) ? 1 : 0);
if (!(mFlags & kIgnoreCodecSpecificData)) {
uint32_t type;
const void *data;
size_t size;
if (meta->findData(kKeyESDS, &type, &data, &size)) {
ESDS ... | cwe | CWE-119 | C/C++ |
CryptSymmetricEncrypt(
BYTE *dOut, // OUT:
TPM_ALG_ID algorithm, // IN: the symmetric algorithm
UINT16 keySizeInBits, // IN: key size in bits
const BYTE *key, // IN: key buffer. The size of this buffer
// ... | cwe | CWE-330 | Unknown |
// Copyright 2015 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 repo
import (
"fmt"
"net/http"
"net/url"
"strings"
"github.com/gogs/git-module"
api "github.com/gogs/go-gogs-client"
jsoniter "github.com/jso... | cwe | CWE-918 | Go |
/* 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.
*/
/*
* register.c: functions for managing re... | cwe | CWE-787 | C/C++ |
/* Copyright (C) 2000-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following... | cwe | CWE-119 | C/C++ |
secret_core_crt (gcry_mpi_t M, gcry_mpi_t C,
gcry_mpi_t D, unsigned int Nlimbs,
gcry_mpi_t P, gcry_mpi_t Q, gcry_mpi_t U)
{
gcry_mpi_t m1 = mpi_alloc_secure ( Nlimbs + 1 );
gcry_mpi_t m2 = mpi_alloc_secure ( Nlimbs + 1 );
gcry_mpi_t h = mpi_alloc_secure ( Nlimbs + 1 );
/* m... | cwe | CWE-310 | C/C++ |
function message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions)
{
global $phpbb_root_path, $phpEx, $user, $template, $auth, $config, $db;
$redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=options");
add_form_key('ucp_pm_options');
// Change "full folder" setting - wha... | cwe | CWE-352 | PHP |
int fscrypt_get_encryption_info(struct inode *inode)
{
struct fscrypt_info *ci = inode->i_crypt_info;
if (!ci ||
(ci->ci_keyring_key &&
(ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) |
(1 << KEY_FLAG_REVOKED) |
(1 << KEY_FLAG_DEAD)))))
return fscrypt_get_crypt_info(inode);
... | cwe | CWE-476 | Unknown |
uint NotificationsEngine::Notify(const QString &app_name, uint replaces_id,
const QString &app_icon, const QString &summary, const QString &body,
const QStringList &actions, const QVariantMap &hints, int timeout)
{
uint partOf = 0;
const QString ... | cwe | CWE-200 | Unknown |
handleSequelizeMethod(smth, tableName, factory, options, prepend) {
if (smth instanceof Utils.Json) {
// Parse nested object
if (smth.conditions) {
const conditions = this.parseConditionObject(smth.conditions).map(
condition =>
`json_unquote(json_extract(${this.quoteIdentif... | cwe | CWE-89 | JavaScript |
status_t SampleTable::setTimeToSampleParams(
off64_t data_offset, size_t data_size) {
if (mTimeToSample != NULL || data_size < 8) {
return ERROR_MALFORMED;
}
uint8_t header[8];
if (mDataSource->readAt(
data_offset, header, sizeof(header)) < (ssize_t)sizeof(header)) {
retu... | cwe | CWE-20 | C/C++ |
modify_principal_2_svc(mprinc_arg *arg, struct svc_req *rqstp)
{
static generic_ret ret;
char *prime_arg;
gss_buffer_desc client_name,
service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
... | cwe | CWE-772 | C/C++ |
Perl_my_setenv(pTHX_ const char *nam, const char *val)
{
dVAR;
#ifdef __amigaos4__
amigaos4_obtain_environ(__FUNCTION__);
#endif
#ifdef USE_ITHREADS
/* only parent thread can modify process environment */
if (PL_curinterp == aTHX)
#endif
{
#ifndef PERL_USE_SAFE_PUTENV
if (!PL_use_safe_putenv) {
/*... | cwe | CWE-190 | C/C++ |
Map1to1(SDL_Palette * src, SDL_Palette * dst, int *identical)
{
Uint8 *map;
int i;
if (identical) {
if (src->ncolors <= dst->ncolors) {
/* If an identical palette, no need to map */
if (src == dst
||
(SDL_memcmp
(src->colors, ... | cwe | CWE-703 | Unknown |
int __cil_build_ast_first_child_helper(__attribute__((unused)) struct cil_tree_node *parse_current, void *extra_args)
{
struct cil_args_build *args = extra_args;
struct cil_tree_node *ast = args->ast;
if (ast->flavor == CIL_TUNABLEIF) {
args->tunif = ast;
}
if (ast->flavor == CIL_IN) {
args->in = ast;
}
i... | cwe | CWE-125 | Unknown |
private function userAuth()
{
$user = new User();
$nick = $this->request->request->get('fsNick', '');
if ($nick === '') {
return $this->cookieAuth($user);
}
if ($user->loadFromCode($nick) && $user->enabled) {
if ($user->verifyPassword($this->request->... | cwe | CWE-79 | PHP |
package com.salesmanager.shop.model.catalog.product.attribute;
import java.io.Serializable;
import java.math.BigDecimal;
import com.salesmanager.shop.model.catalog.product.attribute.api.ProductAttributeEntity;
public class PersistableProductAttribute extends ProductAttributeEntity
implements Serializable {
priv... | cwe | CWE-639 | Java |
print_bacp_config_options(netdissect_options *ndo,
const u_char *p, int length)
{
int len, opt;
if (length < 2)
return 0;
ND_TCHECK2(*p, 2);
len = p[1];
opt = p[0];
if (length < len)
return 0;
if (len < 2) {
ND_PRINT((ndo, "\n\t %s Option (0x%02x), length %u (length bogus, shoul... | cwe | CWE-125 | C/C++ |
log2vis_unicode (PyObject * unicode, FriBidiParType base_direction, int clean, int reordernsm)
{
PyObject *logical = NULL; /* input string encoded in utf-8 */
PyObject *visual = NULL; /* output string encoded in utf-8 */
PyObject *result = NULL; /* unicode output string */
int length = PyUnicode_GET_SIZE (unicode)... | cwe | CWE-119 | C/C++ |
package config
import (
"encoding/base64"
"encoding/json"
"github.com/docker/docker/api/types"
)
type dockerNetworkInterfaces struct {
V4 struct {
Subnet string `default:"172.18.0.0/16"`
Gateway string `default:"172.18.0.1"`
}
V6 struct {
Subnet string `default:"fdba:17c8:6c94::/64"`
Gateway string `... | cwe | CWE-770 | Go |
XFontStruct *XLoadQueryFont(
register Display *dpy,
_Xconst char *name)
{
XFontStruct *font_result;
register long nbytes;
Font fid;
xOpenFontReq *req;
unsigned long seq;
#ifdef USE_XF86BIGFONT
XF86BigfontCodes *extcodes = _XF86BigfontCodes(dpy);
#endif
if (_XF86LoadQueryLocaleFont(dpy... | cwe | CWE-120 | Unknown |
void Context::onDownstreamConnectionClose(PeerType peer_type) {
if (wasm_->onDownstreamConnectionClose_) {
wasm_->onDownstreamConnectionClose_(this, id_, static_cast<uint32_t>(peer_type));
}
} | cwe | CWE-476 | C/C++ |
def likeComments(self,commentid,userid):
sqlText="insert into comment_like values(%d,%d);"%(userid,commentid)
result=sql.insertDB(self.conn,sqlText)
return result; | cwe | CWE-89 | Python |
gpk_parse_fileinfo(sc_card_t *card,
const u8 *buf, size_t buflen,
sc_file_t *file)
{
const u8 *sp, *end, *next;
int i, rc;
memset(file, 0, sizeof(*file));
for (i = 0; i < SC_MAX_AC_OPS; i++)
sc_file_add_acl_entry(file, i, SC_AC_UNKNOWN, SC_AC_KEY_REF_NONE);
end = buf + buflen;
for (sp = buf; sp + 2 < end... | cwe | CWE-125 | C/C++ |
/*
* Copyright(c) 2015 - 2018 Intel Corporation.
*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of vers... | cwe | CWE-416 | 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 |
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-835 | Unknown |
int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *a, ASN1_BIT_STRING *signature,
char *data, EVP_PKEY *pkey)
{
EVP_MD_CTX ctx;
const EVP_MD *type;
unsigned char *p,*buf_in=NULL;
int ret= -1,i,inl;
EVP_MD_CTX_init(&ctx);
i=OBJ_obj2nid(a->algorithm);
type=EVP_get_digestbyname(OBJ_nid2sn(i));
if (type == NULL)
{... | cwe | CWE-310 | Unknown |
var chownr = require('chownr')
var dezalgo = require('dezalgo')
var fs = require('graceful-fs')
var inflight = require('inflight')
var log = require('npmlog')
var mkdirp = require('mkdirp')
// memoize the directories created by this step
var effectiveOwner
module.exports = function correctMkdir (path, cb) {
cb = dez... | cwe | CWE-284 | JavaScript |
int ipmi_si_mem_setup(struct si_sm_io *io)
{
unsigned long addr = io->addr_data;
int mapsize, idx;
if (!addr)
return -ENODEV;
io->io_cleanup = mem_cleanup;
/*
* Figure out the actual readb/readw/readl/etc routine to use based
* upon the register size.
*/
switch (io->regsize) {
case 1:
io->... | cwe | CWE-416 | C/C++ |
static int ec_mul_consttime(const EC_GROUP *group, EC_POINT *r,
const BIGNUM *scalar, const EC_POINT *point,
BN_CTX *ctx)
{
int i, cardinality_bits, group_top, kbit, pbit, Z_is_one;
EC_POINT *s = NULL;
BIGNUM *k = NULL;
BIGNUM *lambda = NULL;
B... | cwe | CWE-320 | Unknown |
package dtls
import (
"github.com/pion/dtls/v2/pkg/protocol"
"github.com/pion/dtls/v2/pkg/protocol/handshake"
"github.com/pion/dtls/v2/pkg/protocol/recordlayer"
)
type fragment struct {
recordLayerHeader recordlayer.Header
handshakeHeader handshake.Header
data []byte
}
type fragmentBuffer struct... | cwe | CWE-835 | Go |
write_coefs_to_file(int valid,time_t ref_time,double offset,double rate)
{
char *temp_coefs_file_name;
FILE *out;
int r1, r2;
/* Create a temporary file with a '.tmp' extension. */
temp_coefs_file_name = (char*) Malloc(strlen(coefs_file_name)+8);
if(!temp_coefs_file_name) {
return RTC_ST_BADFILE;
}... | cwe | CWE-59 | Unknown |
int yr_re_fast_exec(
uint8_t* code,
uint8_t* input_data,
size_t input_size,
int flags,
RE_MATCH_CALLBACK_FUNC callback,
void* callback_args)
{
RE_REPEAT_ANY_ARGS* repeat_any_args;
uint8_t* code_stack[MAX_FAST_RE_STACK];
uint8_t* input_stack[MAX_FAST_RE_STACK];
int matches_stack[MAX_FAST... | cwe | CWE-125 | Unknown |
/**
* <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 |
// Copyright 2018 Project Harbor 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 agr... | cwe | CWE-264 | Go |
// 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 |
static int fuse_rmdir(struct inode *dir, struct dentry *entry)
{
int err;
struct fuse_mount *fm = get_fuse_mount(dir);
FUSE_ARGS(args);
args.opcode = FUSE_RMDIR;
args.nodeid = get_node_id(dir);
args.in_numargs = 1;
args.in_args[0].size = entry->d_name.len + 1;
args.in_args[0].value = entry->d_name.name;
err =... | cwe | CWE-459 | Unknown |
PHP_FUNCTION(dom_document_save)
{
zval *id;
xmlDoc *docp;
int file_len = 0, bytes, format, saveempty = 0;
dom_object *intern;
dom_doc_propsptr doc_props;
char *file;
long options = 0;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &id, dom_document_class_entry, &file, &file_len,... | cwe | CWE-20 | Unknown |
mbfl_strcut(
mbfl_string *string,
mbfl_string *result,
int from,
int length)
{
const mbfl_encoding *encoding;
mbfl_memory_device device;
/* validate the parameters */
if (string == NULL || string->val == NULL || result == NULL) {
return NULL;
}
if (from < 0 || length < 0) {
return NULL;
}
... | cwe | CWE-119 | C/C++ |
pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
{
InitializeCriticalSection(mutex);
return 0;
} | cwe | CWE-703 | Unknown |
protected function curl_get_contents(&$url, $timeout, $redirect_max, $ua, $outfp)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
if ($outfp) {
curl_setopt($ch, CURLOPT_FILE, $outfp);
} else {
curl_set... | cwe | CWE-918 | PHP |
/*
* . .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-79 | JavaScript |
CURLcode Curl_dupset(struct SessionHandle *dst, struct SessionHandle *src)
{
CURLcode result = CURLE_OK;
enum dupstring i;
/* Copy src->set into dst->set first, then deal with the strings
afterwards */
dst->set = src->set;
/* clear all string pointers first */
memset(dst->set.str, 0, STRING_LAST * si... | cwe | CWE-200 | Unknown |
# -*- coding: utf-8 -*-
# Imports ###########################################################
import os
from setuptools import setup
# Functions #########################################################
def package_data(pkg, root_list):
"""Generic function to find package_data for `pkg` under `root`."""
da... | cwe | CWE-79 | Python |
file_continue(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
es_ptr pscratch = esp - 2;
file_enum *pfen = r_ptr(esp - 1, file_enum);
int devlen = esp[-3].value.intval;
gx_io_device *iodev = r_ptr(esp - 4, gx_io_device);
uint len = r_size(pscratch);
uint code;
if (len < devlen)
return_erro... | cwe | CWE-200 | Unknown |
Load_SBit_Png( FT_GlyphSlot slot,
FT_Int x_offset,
FT_Int y_offset,
FT_Int pix_bits,
TT_SBit_Metrics metrics,
FT_Memory memory,
FT_Byte* data,
FT_UInt ... | cwe | CWE-119 | C/C++ |
sg_fill_request_table(Sg_fd *sfp, sg_req_info_t *rinfo)
{
Sg_request *srp;
int val;
unsigned int ms;
val = 0;
list_for_each_entry(srp, &sfp->rq_list, entry) {
if (val > SG_MAX_QUEUE)
break;
memset(&rinfo[val], 0, SZ_SG_REQ_INFO);
rinfo[val].req_state = srp->done + 1;
rinfo[val].problem =
srp->header... | cwe | CWE-200 | Unknown |
backward_search(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
const UChar* range, UChar* adjrange, UChar** low, UChar** high)
{
UChar *p;
p = s;
retry:
switch (reg->optimize) {
case OPTIMIZE_STR:
exact_method:
p = slow_search_backward(reg->enc, reg->exact, reg->exact_end,
... | cwe | CWE-125 | Unknown |
do_restrict(
sockaddr_u *srcadr,
endpt *inter,
struct req_pkt *inpkt,
int op
)
{
char * datap;
struct conf_restrict cr;
u_short items;
size_t item_sz;
sockaddr_u matchaddr;
sockaddr_u matchmask;
int bad;
/*
* Do a check of the flags to make sure that only
* the NTPPORT flag is set, if any. ... | cwe | CWE-190 | Unknown |
RList *r_bin_le_get_sections(r_bin_le_obj_t *bin) {
RList *l = r_list_newf ((RListFree)r_bin_section_free);
if (!l) {
return NULL;
}
LE_image_header *h = bin->header;
ut32 pages_start_off = h->datapage;
int i;
for (i = 0; i < h->objcnt; i++) {
RBinSection *sec = R_NEW0 (RBinSection);
if (!sec) {
return ... | cwe | CWE-252 | C/C++ |
_g_file_remove_directory (GFile *directory,
GCancellable *cancellable,
GError **error)
{
GFileEnumerator *enumerator;
GFileInfo *info;
gboolean error_occurred = FALSE;
if (directory == NULL)
return TRUE;
enumerator = g_file_enumerate_children (directory,
G_FI... | cwe | CWE-20 | Unknown |
def _create_3par_fibrechan_host(self, hostname, wwn, domain, persona_id):
"""Create a 3PAR host.
Create a 3PAR host, if there is already a host on the 3par using
the same wwn but with a different hostname, return the hostname
used by 3PAR.
"""
out = self.common._cli_run(... | cwe | CWE-78 | Python |
void VaapiVideoDecodeAccelerator::Cleanup() {
DCHECK(task_runner_->BelongsToCurrentThread());
base::AutoLock auto_lock(lock_);
if (state_ == kUninitialized || state_ == kDestroying)
return;
VLOGF(2) << "Destroying VAVDA";
state_ = kDestroying;
client_ptr_factory_.reset();
weak_this_factory_.Inval... | cwe | CWE-362 | C/C++ |
function draw_cdef_preview($cdef_id) {
?>
<tr class='even'>
<td style='padding:4px'>
<pre>cdef=<?php print get_cdef($cdef_id, true);?></pre>
</td>
</tr>
<?php
} | cwe | CWE-79 | PHP |
func defaultLocation(x ast.Node) *ast.Location {
return ast.NewLocation([]byte(x.String()), "", 1, 1)
} | cwe | CWE-682 | Go |
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
* Copyright (c) 2016 Facebook
* Copyright (c) 2018 Covalent IO, Inc. http://covalent.io
*/
#include <uapi/linux/btf.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/bpf.h>
#i... | cwe | CWE-863 | C/C++ |
function writeCommentDate(comment, dateDiv)
{
dateDiv.innerHTML = '';
var ts = new Date(comment.modifiedDate);
var str = editorUi.timeSince(ts);
if (str == null)
{
str = mxResources.get('lessThanAMinute');
}
mxUtils.write(dateDiv, mxResources.get('timeAgo', [str], '{1} ago'));
dateDiv.setAttri... | cwe | CWE-94 | JavaScript |
int journal_remote_handle_raw_source(
sd_event_source *event,
int fd,
uint32_t revents,
RemoteServer *s) {
RemoteSource *source;
int r;
/* Returns 1 if there might be more data pending,
* 0 if data is currently exhausted,... | cwe | CWE-770 | Unknown |
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 PageFormAnalyserLogger::Flush() {
std::string text;
for (ConsoleLevel level : {kError, kWarning, kVerbose}) {
for (LogEntry& entry : node_buffer_[level]) {
text.clear();
text += "[DOM] ";
text += entry.message;
for (unsigned i = 0; i < entry.nodes.size(); ++i)
text += " %... | cwe | CWE-119 | C/C++ |
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */
/*
* http_client.c -- A simple HTTP/QUIC client
*/
#ifndef WIN32
#include <arpa/inet.h>
#include <netinet/in.h>
#else
#include <Windows.h>
#include <WinSock2.h>
#include <io.h>
#include <stdlib.h>
#include <getopt.h>
#define STDOUT_FILENO 1
#d... | cwe | CWE-476 | C/C++ |
import copy
import hashlib
import math
import secrets
import typing
from http import HTTPStatus
import orjson
from fastapi import APIRouter, Form, Request
from fastapi.responses import HTMLResponse, RedirectResponse, Response
from sqlalchemy import and_, or_
import aurweb.config
from aurweb import cookies, db, defaul... | cwe | CWE-200 | Python |
PHP_METHOD(Phar, addEmptyDir)
{
char *dirname;
size_t dirname_len;
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &dirname, &dirname_len) == FAILURE) {
return;
}
if (dirname_len >= sizeof(".phar")-1 && !memcmp(dirname, ".phar", sizeof(".phar")-1)) {
zend_throw_exception_ex(spl_ce_Ba... | cwe | CWE-20 | Unknown |
package tar
import (
"archive/tar"
"fmt"
"io"
"os"
gopath "path"
fp "path/filepath"
"strings"
)
type Extractor struct {
Path string
Progress func(int64) int64
// SanitizePathFunc can be provided if you wish to inspect and/or modify the source path
// returning an error from this function will abort ex... | cwe | CWE-22 | Go |
return func(w http.ResponseWriter, r *http.Request) {
playlistId := utils.ParamString(r, ":playlistId")
tracksRepo := ds.Playlist(r.Context()).Tracks(playlistId)
var payload addTracksPayload
err := json.NewDecoder(r.Body).Decode(&payload)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
... | cwe | CWE-79 | Go |
UnicodeString DecimalQuantity::toScientificString() const {
U_ASSERT(!isApproximate);
UnicodeString result;
if (isNegative()) {
result.append(u'-');
}
if (precision == 0) {
result.append(u"0E+0", -1);
return result;
}
// NOTE: It is not safe to add to lOptPos (aka max... | cwe | CWE-190 | Java |
static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
int addr_len)
{
struct sockaddr_in6 *usin = (struct sockaddr_in6 *)uaddr;
struct inet_connection_sock *icsk = inet_csk(sk);
struct inet_sock *inet = inet_sk(sk);
struct ipv6_pinfo *np = inet6_sk(sk);
struct dccp_sock *dp = dccp_sk(sk);
stru... | cwe | CWE-284 | Unknown |
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{
PadContext *s = inlink->dst->priv;
AVFrame *out;
int needs_copy = frame_needs_copy(s, in);
if (needs_copy) {
av_log(inlink->dst, AV_LOG_DEBUG, "Direct padding impossible allocating new frame\n");
out = ff_get_video_buffer(inli... | cwe | CWE-119 | C/C++ |
foreach ($val as $k => $v) {
unset($process[$key][$k]);
$stripTags = \in_array($k, $whiteList) ? false : $stripTagsConf;
if (\is_string($k)) {
$filteredKey = self::filterValue($k, $regex, $stripTags);
} else {
$filt... | cwe | CWE-79 | PHP |
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef WIN32
#include <arpa/inet.h>
#else
#include <vc_compat.h>
#endif
#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <sys/queue.h>
#include <openssl/x509.h>
#include "lsquic.h"
#include "lsquic_type... | cwe | CWE-476 | C/C++ |
/* The ziplist is a specially encoded dually linked list that is designed
* to be very memory efficient. It stores both strings and integer values,
* where integers are encoded as actual integers instead of a series of
* characters. It allows push and pop operations on either side of the list
* in O(1) time. Howeve... | cwe | CWE-680 | C/C++ |
func (voteSet *VoteSet) MakeCommit() *Commit {
if voteSet.signedMsgType != tmproto.PrecommitType {
panic("Cannot MakeCommit() unless VoteSet.Type is PrecommitType")
}
voteSet.mtx.Lock()
defer voteSet.mtx.Unlock()
// Make sure we have a 2/3 majority
if voteSet.maj23 == nil {
panic("Cannot MakeCommit() unless ... | cwe | CWE-347 | Go |
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium
package clustermesh
import (
"bytes"
"context"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io"
"net"
"regexp"
"strconv"
"strings"
"text/tabwriter"
"time"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/... | cwe | CWE-755 | Go |
/*
* Copyright (c) 2007-2021, Arshan Dabirsiaghi, Jason Li
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this li... | cwe | CWE-79 | Java |
exif_mnote_data_canon_load (ExifMnoteData *ne,
const unsigned char *buf, unsigned int buf_size)
{
ExifMnoteDataCanon *n = (ExifMnoteDataCanon *) ne;
ExifShort c;
size_t i, tcount, o, datao;
if (!n || !buf || !buf_size) {
exif_log (ne->log, EXIF_LOG_CODE_CORRUPT_DATA,
"ExifMnoteCanon", "Short MakerNote");
... | cwe | CWE-703 | C/C++ |
mxCellEditor.prototype.installListeners=function(a){mxEvent.addListener(a,"dragstart",mxUtils.bind(this,function(d){this.graph.stopEditing(!1);mxEvent.consume(d)}));mxEvent.addListener(a,"blur",mxUtils.bind(this,function(d){this.blurEnabled&&this.focusLost(d)}));mxEvent.addListener(a,"keydown",mxUtils.bind(this,functio... | cwe | CWE-94 | JavaScript |
show_status: function() {
return '<span style="' + this.get('status_style') + '">'
+ this.get('status') + (this.get("is_unmanaged") ? " (unmanaged)" : "")
+ '</span>';
}.property("status_style", "disabled"), | cwe | CWE-79 | JavaScript |
/********************************************************************************/
/* */
/* Symmetric block cipher modes */
/* Written by Ken Goldman */
/* IBM Thomas J. Watson Research Center */
/* $Id: CryptSym.c 1594 2020-03-26 22:15:48Z kgoldman $ */
/* */
... | cwe | CWE-327 | C/C++ |
function GETPOST($paramname,$check='',$method=0)
{
if (empty($method)) $out = isset($_GET[$paramname])?$_GET[$paramname]:(isset($_POST[$paramname])?$_POST[$paramname]:'');
elseif ($method==1) $out = isset($_GET[$paramname])?$_GET[$paramname]:'';
elseif ($method==2) $out = isset($_POST[$paramname])?$_POST[$paramname]... | cwe | CWE-22 | PHP |
rsyncssh.action = function( inlet )
local event, event2 = inlet.getEvent( )
local config = inlet.getConfig( )
-- makes move local on target host
-- if the move fails, it deletes the source
if event.etype == 'Move' then
log(
'Normal',
'Moving ',
event.path,
' -> ',
event2.path
)
spawn(
... | cwe | CWE-77 | Lua |
// Sandstorm - Personal Cloud Sandbox
// Copyright (c) 2016 Sandstorm Development Group, Inc. and contributors
// 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
//
/... | cwe | CWE-918 | JavaScript |
static pyc_object *get_object(RBuffer *buffer) {
bool error = false;
pyc_object *ret = NULL;
ut8 code = get_ut8 (buffer, &error);
bool flag = (code & FLAG_REF);
RListIter *ref_idx = NULL;
ut8 type = (code & ~FLAG_REF);
if (error) {
return NULL;
}
if (flag) {
pyc_object *noneret = get_none_object ();
if... | cwe | CWE-416 | Unknown |
gopherToHTML(GopherStateData * gopherState, char *inbuf, int len)
{
char *pos = inbuf;
char *lpos = NULL;
char *tline = NULL;
LOCAL_ARRAY(char, line, TEMP_BUF_SIZE);
LOCAL_ARRAY(char, tmpbuf, TEMP_BUF_SIZE);
char *name = NULL;
char *selector = NULL;
char *host = NULL;
char *port = NU... | cwe | CWE-400 | C/C++ |
pixFillMapHoles(PIX *pix,
l_int32 nx,
l_int32 ny,
l_int32 filltype)
{
l_int32 w, h, y, nmiss, goodcol, i, j, found, ival, valtest;
l_uint32 val, lastval;
NUMA *na; /* indicates if there is any data in the column */
PIX *pixt;
PROCNAME("pixFillMapH... | cwe | CWE-125 | C/C++ |
evbuffer_chain_new(size_t size)
{
struct evbuffer_chain *chain;
size_t to_alloc;
size += EVBUFFER_CHAIN_SIZE;
/* get the next largest memory that can hold the buffer */
to_alloc = MIN_BUFFER_SIZE;
while (to_alloc < size)
to_alloc <<= 1;
/* we get everything in one chunk */
if ((chain = mm_malloc(to_alloc))... | cwe | CWE-189 | Unknown |
package validation
import (
"fmt"
"math"
"reflect"
"strconv"
"strings"
"text/scanner"
"github.com/graph-gophers/graphql-go/errors"
"github.com/graph-gophers/graphql-go/internal/common"
"github.com/graph-gophers/graphql-go/internal/query"
"github.com/graph-gophers/graphql-go/types"
)
type varSet map[*types.... | cwe | CWE-400 | Go |
long Cluster::Load(long long& pos, long& len) const
{
assert(m_pSegment);
assert(m_pos >= m_element_start);
if (m_timecode >= 0) //at least partially loaded
return 0;
assert(m_pos == m_element_start);
assert(m_element_size < 0);
IMkvReader* const pReader = m_pSegment->m_pReader;
... | cwe | CWE-119 | C/C++ |
/** @odoo-module **/
import { registry } from "@web/core/registry";
import {
Many2OneAvatarUserField,
KanbanMany2OneAvatarUserField,
many2OneAvatarUserField,
kanbanMany2OneAvatarUserField,
} from "@mail/web/fields/many2one_avatar_user_field/many2one_avatar_user_field";
export class Many2OneAvatarEmplo... | cwe | CWE-732 | C/C++ |
def save_failure_transaction(self, user_id, project_id, money):
self.cursor.execute("insert into transactions (project_id,user_id, money, timestamp, state) values (%s, %s, %s, now(), 'failed' )" % (project_id, user_id, money))
self.db.commit() | cwe | CWE-89 | Python |
void Compute(OpKernelContext* context) override {
const Tensor& input = context->input(0);
const TensorShape& input_shape = input.shape();
const int32 input_dims = input_shape.dims();
const Tensor& segment_id = context->input(1);
const TensorShape& segment_id_shape = segment_id.shape();
const i... | cwe | CWE-703 | C/C++ |
get_it (PKT_pubkey_enc *enc, DEK *dek, PKT_public_key *sk, u32 *keyid)
{
gpg_error_t err;
byte *frame = NULL;
unsigned int n;
size_t nframe;
u16 csum, csum2;
int padding;
gcry_sexp_t s_data;
char *desc;
char *keygrip;
byte fp[MAX_FINGERPRINT_LEN];
size_t fpn;
if (DBG_CLOCK)
log_clock ("decr... | cwe | CWE-20 | Unknown |
def repack(host, targets, channel='stable'):
url = 'https://static.rust-lang.org/dist/channel-rust-' + channel + '.toml'
req = requests.get(url)
req.raise_for_status()
manifest = toml.loads(req.content)
if manifest['manifest-version'] != '2':
print('ERROR: unrecognized manifest version %s.' % manifest['ma... | cwe | CWE-78 | Python |
rpmVerifyAttrs rpmfilesVerify(rpmfiles fi, int ix, rpmVerifyAttrs omitMask)
{
rpm_mode_t fmode = rpmfilesFMode(fi, ix);
rpmfileAttrs fileAttrs = rpmfilesFFlags(fi, ix);
rpmVerifyAttrs flags = rpmfilesVFlags(fi, ix);
const char * fn = rpmfilesFN(fi, ix);
struct stat sb;
rpmVerifyAttrs vfy = RPMVE... | cwe | CWE-59 | C/C++ |
show() {
if ($(this.element).css('display') === 'none') {
throw new Error('Please use show on visible elements')
}
const showEvent = $.Event(this.constructor.Event.SHOW)
if (this.isWithContent() && this._isEnabled) {
$(this.element).trigger(showEvent)
const isInTheDom =... | cwe | CWE-79 | JavaScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.