code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
static int hns_xgmac_get_sset_count(int stringset)
{
if (stringset == ETH_SS_STATS)
return ARRAY_SIZE(g_xgmac_stats_string);
return 0;
} | cwe | CWE-703 | Unknown |
static void jsiLNGetMatches(const char *str, linenoiseCompletions *lc) {
char buf[1000], pre[1000], hpre[6] = {};
const char *cp, *fnam = "Info.completions";
int i = 0, len;
int rc, isfile = 0, start = 0, end = Jsi_Strlen(str);
Jsi_Interp* interp = jsi_interactiveInterp;
if (!Jsi_Strncmp(str, "h... | cwe | CWE-120 | C/C++ |
// SPDX-License-Identifier: BSD-2-Clause
/*
Copyright (c) 2012-2016, Matthias Schiffer <mschiffer@universe-factory.net>
All rights reserved.
*/
/**
\file
Functions for receiving and handling packets
*/
#include "fastd.h"
#include "handshake.h"
#include "hash.h"
#include "peer.h"
#include "peer_hashtable.h... | cwe | CWE-617 | C/C++ |
int rsa_rsassa_pss_verify( rsa_context *ctx,
int mode,
int hash_id,
unsigned int hashlen,
const unsigned char *hash,
unsigned char *sig )
{
int ret;
size_t siglen;
unsigned ... | cwe | CWE-310 | Unknown |
command_process_create_cell(cell_t *cell, or_connection_t *conn)
{
or_circuit_t *circ;
int id_is_high;
if (we_are_hibernating()) {
log_info(LD_OR,
"Received create cell but we're shutting down. Sending back "
"destroy.");
connection_or_send_destroy(cell->circ_id, conn,
... | cwe | CWE-264 | C/C++ |
function render(&$caller, $username = '') {
$loginOnClick = 'return true;';
// Try To Use Challene response
// TODO javascript might need some improvement for work on other browsers
if($caller->advancedsecurity && $caller->storage->supportsChallengeResponse() ) {
// Init th... | cwe | CWE-89 | JavaScript |
ZlibInStream::ZlibInStream(int bufSize_)
: underlying(0), bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0),
zs(NULL), bytesIn(0)
{
ptr = end = start = new U8[bufSize];
init();
} | cwe | CWE-122 | C/C++ |
int run_diff_files(struct rev_info *revs, unsigned int option)
{
int entries, i;
int diff_unmerged_stage = revs->max_count;
int silent_on_removed = option & DIFF_SILENT_ON_REMOVED;
unsigned ce_option = ((option & DIFF_RACY_IS_MODIFIED)
? CE_MATCH_RACY_IS_DIRTY : 0);
char symcache[PATH_MAX];
if (diff_unm... | cwe | CWE-119 | Unknown |
GF_Err BD_DecMFFieldVec(GF_BifsDecoder * codec, GF_BitStream *bs, GF_Node *node, GF_FieldInfo *field, Bool is_mem_com)
{
GF_Err e;
u32 NbBits, nbFields;
u32 i;
GF_ChildNodeItem *last;
u8 qp_local, qp_on, initial_qp;
GF_FieldInfo sffield;
memset(&sffield, 0, sizeof(GF_FieldInfo));
sffield.fieldIndex = field->fi... | cwe | CWE-416 | C/C++ |
/* Common methods shared between FTP and TFTP engines
*
* Copyright (c) 2014-2019 Joachim Nilsson <troglobit@gmail.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission noti... | cwe | CWE-22 | C/C++ |
static int chip_command(struct i2c_client *client,
unsigned int cmd, void *arg)
{
struct CHIPSTATE *chip = i2c_get_clientdata(client);
struct CHIPDESC *desc = chip->desc;
if (debug > 0) {
v4l_i2c_print_ioctl(chip->c, cmd);
printk("\n");
}
switch (cmd) {
case AUDC_SET_RADIO:
chip->radio = 1;
chip->wa... | cwe | CWE-399 | Unknown |
static inline int l2cap_config_req(struct l2cap_conn *conn,
struct l2cap_cmd_hdr *cmd, u16 cmd_len,
u8 *data)
{
struct l2cap_conf_req *req = (struct l2cap_conf_req *) data;
u16 dcid, flags;
u8 rsp[64];
struct l2cap_chan *chan;
int len, err = 0;
if (cmd_len < sizeof(*req))
return -EPROTO;
dcid ... | cwe | CWE-787 | Unknown |
PGTYPEStimestamp_from_asc(char *str, char **endptr)
{
timestamp result;
#ifdef HAVE_INT64_TIMESTAMP
int64 noresult = 0;
#else
double noresult = 0.0;
#endif
fsec_t fsec;
struct tm tt,
*tm = &tt;
int dtype;
int nf;
char *field[MAXDATEFIELDS];
int ftype[MAXDATEFIELDS];
char lowstr[MAXDATELEN ... | cwe | CWE-119 | C/C++ |
void PrintViewManagerBase::OnDidPrintPage(
const PrintHostMsg_DidPrintPage_Params& params) {
if (!OpportunisticallyCreatePrintJob(params.document_cookie))
return;
PrintedDocument* document = print_job_->document();
if (!document || params.document_cookie != document->cookie()) {
return;
}
#if def... | cwe | CWE-254 | C/C++ |
// SPDX-License-Identifier: BSD-2-Clause
/*
* Copyright (c) 2014, STMicroelectronics International N.V.
*/
#include <assert.h>
#include <compiler.h>
#include <crypto/crypto.h>
#include <kernel/tee_ta_manager.h>
#include <mm/tee_mmu.h>
#include <string_ext.h>
#include <string.h>
#include <sys/queue.h>
#include <tee_a... | cwe | CWE-787 | C/C++ |
TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
{
TIFFDirectory *td = &tif->tif_dir;
char *sep;
long l, n;
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
fprintf(fd, "TIFF Directory at offset 0x%I64x (%I64u)\n",
(unsigned __int64) tif->tif_diroff,
(unsigned __int64) tif->tif_diroff);... | cwe | CWE-476 | C/C++ |
$scope.initialize = function() {
growl.success('Retrieving definition for requisition ' + $scope.foreignSource + '...');
RequisitionsService.getForeignSourceDefinition($scope.foreignSource).then(
function(foreignSourceDef) { // success
$scope.foreignSourceDef = foreignSourceDef;
... | cwe | CWE-79 | JavaScript |
static int dbConnect(char *host, char *user, char *passwd)
{
DBUG_ENTER("dbConnect");
if (verbose)
{
fprintf(stderr, "# Connecting to %s...\n", host ? host : "localhost");
}
mysql_init(&mysql_connection);
if (opt_compress)
mysql_options(&mysql_connection, MYSQL_OPT_COMPRESS, NullS);
#ifdef HAVE_OPEN... | cwe | CWE-319 | Unknown |
function A(aa,ca,na){var la=F.menus.get(aa),oa=O.addMenu(mxResources.get(aa),mxUtils.bind(this,function(){la.funct.apply(this,arguments)}),W);oa.className=
"1"==urlParams.sketch?"geToolbarButton":"geMenuItem";oa.style.display="inline-block";oa.style.boxSizing="border-box";oa.style.top="6px";oa.style.marginRight="6px";o... | cwe | CWE-94 | JavaScript |
/*
* TechnoTrend PVA (.pva) demuxer
* Copyright (c) 2007, 2008 Ivo van Poorten
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 o... | cwe | CWE-835 | C/C++ |
# Copyright (C) 2012 Canonical Ltd.
# Copyright (C) 2012, 2013 Hewlett-Packard Development Company, L.P.
# Copyright (C) 2012 Yahoo! Inc.
#
# This file is part of cloud-init. See LICENSE file for license information.
import copy
import os
import sys
from collections import namedtuple
from typing import Dict, Iterable,... | cwe | CWE-532 | Python |
/* 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-617 | Python |
PHP_FUNCTION(openssl_seal)
{
zval *pubkeys, *pubkey, *sealdata, *ekeys, *iv = NULL;
HashTable *pubkeysht;
EVP_PKEY **pkeys;
zend_resource ** key_resources; /* so we know what to cleanup */
int i, len1, len2, *eksl, nkeys, iv_len;
unsigned char iv_buf[EVP_MAX_IV_LENGTH + 1], *buf = NULL, **eks;
char * data;
size... | cwe | CWE-754 | C/C++ |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# webgateway/views.py - django application view handling functions
#
# Copyright (c) 2007-2020 Glencoe Software, Inc. All rights reserved.
#
# This software is distributed under the terms described by the LICENCE file
# you can find at the root of the distribution bundle,... | cwe | CWE-200 | Python |
Toolbar.prototype.setFontSize = function(value)
{
if (this.sizeMenu != null)
{
this.sizeMenu.innerHTML = '';
var div = document.createElement('div');
div.style.display = 'inline-block';
div.style.overflow = 'hidden';
div.style.textOverflow = 'ellipsis';
div.style.maxWidth = '24px';
mxUtils.write(div, va... | cwe | CWE-94 | 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-20 | Python |
/*
* 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 |
sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
{
SDHCIState *s = (SDHCIState *)opaque;
unsigned shift = 8 * (offset & 0x3);
uint32_t mask = ~(((1ULL << (size * 8)) - 1) << shift);
uint32_t value = val;
value <<= shift;
if (timer_pending(s->transfer_timer)) {
sdhc... | cwe | CWE-119 | C/C++ |
function init() {
if (typeof window.BroadcastChannel === 'function') {
channel = new window.BroadcastChannel(uniq_prefix);
channel.addEventListener('message', function(event) {
if (event.target.name === uniq_prefix) {
var key = event.data && event.data... | cwe | CWE-346 | JavaScript |
PHP_FUNCTION(pg_trace)
{
char *z_filename, *mode = "w";
int z_filename_len, mode_len;
zval *pgsql_link = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
PGconn *pgsql;
FILE *fp = NULL;
php_stream *stream;
id = PGG(default_link);
if (zend_parse_parameters(argc TSRMLS_CC, "s|sr", &z_filename, &z... | cwe | CWE-200 | C/C++ |
status_t OMXNodeInstance::freeBuffer(
OMX_U32 portIndex, OMX::buffer_id buffer) {
Mutex::Autolock autoLock(mLock);
CLOG_BUFFER(freeBuffer, "%s:%u %#x", portString(portIndex), portIndex, buffer);
removeActiveBuffer(portIndex, buffer);
OMX_BUFFERHEADERTYPE *header = findBufferHeader(buffer);
... | cwe | CWE-119 | C/C++ |
xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
xmlNodePtr elem, const xmlChar *name, const xmlChar *value) {
xmlChar *ret, *dst;
const xmlChar *src;
xmlAttributePtr attrDecl = NULL;
int extsubset = 0;
if (doc == NULL) return(NULL);
if (elem == NULL) return(NULL);... | cwe | CWE-416 | Unknown |
elFinder.prototype.commands.getfile = function() {
var self = this,
fm = this.fm,
filter = function(files) {
var o = self.options;
files = $.map(files, function(file) {
return file.mime != 'directory' || o.folders ? file : null;
});
return o.multiple || files.length == 1 ? files : [];
};
... | cwe | CWE-89 | JavaScript |
_pickle_UnpicklerMemoProxy_copy_impl(UnpicklerMemoProxyObject *self)
/*[clinic end generated code: output=e12af7e9bc1e4c77 input=97769247ce032c1d]*/
{
Py_ssize_t i;
PyObject *new_memo = PyDict_New();
if (new_memo == NULL)
return NULL;
for (i = 0; i < self->unpickler->memo_size; i++) {
i... | cwe | CWE-369 | Unknown |
private function _getMetaTags()
{
$retval = '<meta charset="utf-8" />';
$retval .= '<meta name="robots" content="noindex,nofollow" />';
$retval .= '<meta http-equiv="X-UA-Compatible" content="IE=Edge">';
$retval .= '<style>html{display: none;}</style>';
return $retval;
} | cwe | CWE-20 | PHP |
addlists (char **old, char **new)
{
int i;
if (old == NULL || new == NULL)
return NULL;
for (i = 0; new[i] != NULL; ++i)
{
old = enlist(old, new[i], strlen(new[i]));
if (old == NULL)
break;
}
return old;
} | cwe | CWE-189 | Unknown |
static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd, void __user *user_arg)
{
struct hid_device *hid = hiddev->hid;
struct hiddev_report_info rinfo;
struct hiddev_usage_ref_multi *uref_multi = NULL;
struct hiddev_usage_ref *uref;
struct hid_report *report;
struct hid_field *field;
int ... | cwe | CWE-119 | C/C++ |
accessToken: chance.hash()
},
function (err, user) {
if (err) return apiUtil.sendApiError(res, 500, err.message)
savedId = user._id
return user.populate('role', next)
}
)
}, | cwe | CWE-521 | JavaScript |
def project_configure(request, project_name):
"""
get configuration
:param request: request object
:param project_name: project name
:return: json
"""
# get configuration
if request.method == 'GET':
project = Project.objects.get(name=project_name)
project = model_to_dict(... | cwe | CWE-78 | Python |
usm_free_usmStateReference(void *old)
{
struct usmStateReference *old_ref = (struct usmStateReference *) old;
if (old_ref) {
if (old_ref->usr_name_length)
SNMP_FREE(old_ref->usr_name);
if (old_ref->usr_engine_id_length)
SNMP_FREE(old_ref->usr_engine_id);
if (old... | cwe | CWE-415 | C/C++ |
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear... | cwe | CWE-787 | C/C++ |
def get(self, space_id):
""" Fetch data for space with the corresponding space_id """
return database_utilities.execute_query(
f"""select * from spaces where space_id = '{space_id}'""") | cwe | CWE-89 | Python |
njs_promise_perform_all_handler(njs_vm_t *vm, njs_iterator_args_t *args,
njs_value_t *value, int64_t index)
{
njs_int_t ret;
njs_array_t *array;
njs_value_t arguments[2], next;
njs_function_t *on_fulfilled;
njs_promise_capability... | cwe | CWE-703 | Unknown |
public function doConfigPageInit($page) {
$action = isset($_REQUEST['action'])?$_REQUEST['action']:'';
//the extension we are currently displaying
$managerdisplay = isset($_REQUEST['managerdisplay'])?$_REQUEST['managerdisplay']:'';
$name = isset($_REQUEST['name'])?$_REQUEST['name']:'';
$secret = isset($_REQUE... | cwe | CWE-79 | PHP |
void print_cfs_stats(struct seq_file *m, int cpu)
{
struct cfs_rq *cfs_rq, *pos;
rcu_read_lock();
for_each_leaf_cfs_rq_safe(cpu_rq(cpu), cfs_rq, pos)
print_cfs_rq(m, cpu, cfs_rq);
rcu_read_unlock();
} | cwe | CWE-400 | Unknown |
__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
{
struct nlmsghdr *nlh;
int size = NLMSG_LENGTH(len);
nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size));
nlh->nlmsg_type = type;
nlh->nlmsg_len = size;
nlh->nlmsg_flags = flags;
nlh->nlmsg_pid = pid;
nlh->nlmsg_seq = seq;
r... | cwe | CWE-200 | Unknown |
protected function _mkdir($path, $name) {
$path = $this->_joinPath($path, $name);
if (@mkdir($path)) {
@chmod($path, $this->options['dirMode']);
clearstatcache();
return $path;
}
return false;
} | cwe | CWE-89 | JavaScript |
/* nbdkit
* Copyright (C) 2013-2019 Red Hat Inc.
*
* 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 f... | cwe | CWE-617 | C/C++ |
'use strict';
const assert = require('assert');
const renderer = require('./renderer');
const chromeLauncher = require('chrome-launcher');
const express = require('express');
const fs = require('fs');
const compression = require('compression');
const path = require('path');
const https = require('https');
const app = ... | cwe | CWE-22 | JavaScript |
/*
* linux/fs/lockd/svclock.c
*
* Handling of server-side locks, mostly of the blocked variety.
* This is the ugliest part of lockd because we tread on very thin ice.
* GRANT and CANCEL calls may get stuck, meet in mid-flight, etc.
* IMNSHO introducing the grant callback into the NLM protocol was one
* of the wo... | cwe | CWE-404 | C/C++ |
Status GetMatchingPaths(FileSystem* fs, Env* env, const string& pattern,
std::vector<string>* results) {
results->clear();
if (pattern.empty()) {
return Status::OK();
}
string fixed_prefix = pattern.substr(0, pattern.find_first_of("*?[\\"));
string eval_pattern = pattern;
string... | cwe | CWE-125 | C/C++ |
cl_ulong4 Dispatcher::Device::createSeed() {
#ifdef PROFANITY_DEBUG
cl_ulong4 r;
r.s[0] = 1;
r.s[1] = 1;
r.s[2] = 1;
r.s[3] = 1;
return r;
#else
// Randomize private keys
std::random_device rd;
std::mt19937_64 eng(rd());
std::uniform_int_distribution<cl_ulong> distr;
cl_ulong4 r;
r.s[0] = distr(eng);
r.s[... | cwe | CWE-703 | Unknown |
/*
** kernel.c - Kernel module
**
** See Copyright Notice in mruby.h
*/
#include <mruby.h>
#include <mruby/array.h>
#include <mruby/hash.h>
#include <mruby/class.h>
#include <mruby/proc.h>
#include <mruby/string.h>
#include <mruby/variable.h>
#include <mruby/error.h>
#include <mruby/istruct.h>
typedef enum {
NOEX_P... | cwe | CWE-476 | C/C++ |
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Update Data PDUs
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2016 Armin Novak <armin.novak@thincast.com>
* Copyright 2016 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* ... | cwe | CWE-125 | C/C++ |
TfLiteRegistration OkOpRegistration() {
TfLiteRegistration reg = {nullptr, nullptr, nullptr, nullptr};
// Set output size to the input size in OkOp::Prepare(). Code exists to have
// a framework in Prepare. The input and output tensors are not used.
reg.prepare = [](TfLiteContext* context, TfLiteNode* ... | cwe | CWE-787 | C/C++ |
mptctl_mpt_command (unsigned long arg)
{
struct mpt_ioctl_command __user *uarg = (void __user *) arg;
struct mpt_ioctl_command karg;
MPT_ADAPTER *ioc;
int iocnum;
int rc;
if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_command))) {
printk(KERN_ERR MYNAM "%s@%d::mptctl_mpt_command - "
"Unable to ... | cwe | CWE-362 | C/C++ |
function escapeArgBash(arg, interpolation, quoted) {
let result = arg.replace(/\0/gu, "");
if (interpolation) {
result = result
.replace(/\\/gu, "\\\\")
.replace(/\n/gu, " ")
.replace(/(^|\s)(~|#)/gu, "$1\\$2")
.replace(/(\*|\?)/gu, "\\$1")
.replace(/([$&;|])/gu, "\\$1")
.re... | cwe | CWE-400 | JavaScript |
bool do_notify_parent(struct task_struct *tsk, int sig)
{
struct kernel_siginfo info;
unsigned long flags;
struct sighand_struct *psig;
bool autoreap = false;
u64 utime, stime;
BUG_ON(sig == -1);
/* do_notify_parent_cldstop should have been called instead. */
BUG_ON(task_is_stopped_or_traced(tsk));
BUG_O... | cwe | CWE-190 | C/C++ |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
auto* params =
reinterpret_cast<TfLiteConcatenationParams*>(node->builtin_data);
int axis = params->axis;
int num_inputs = node->inputs->size;
// The number of dimensions of the input tensors must match, and all
// dimensions except 'axis... | cwe | CWE-476 | 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-125 | Java |
px_crypt_des(const char *key, const char *setting)
{
int i;
uint32 count,
salt,
l,
r0,
r1,
keybuf[2];
char *p;
uint8 *q;
static char output[21];
if (!des_initialised)
des_init();
/*
* Copy the key, shifting each character up by one bit and padding with
* zeros.
*/
q = ... | cwe | CWE-310 | Unknown |
find_extend_vma(struct mm_struct *mm, unsigned long addr)
{
struct vm_area_struct *vma, *prev;
addr &= PAGE_MASK;
vma = find_vma_prev(mm, addr, &prev);
if (vma && (vma->vm_start <= addr))
return vma;
if (!prev || expand_stack(prev, addr))
return NULL;
if (prev->vm_flags & VM_LOCKED)
populate_vma_page_range... | cwe | CWE-667 | C/C++ |
wb_prep(netdissect_options *ndo,
const struct pkt_prep *prep, u_int len)
{
int n;
const struct pgstate *ps;
const u_char *ep = ndo->ndo_snapend;
ND_PRINT((ndo, " wb-prep:"));
if (len < sizeof(*prep)) {
return (-1);
}
n = EXTRACT_32BITS(&prep->pp_n);
ps = (const struct pgstate *)(prep + 1);
while (--... | cwe | CWE-20 | C/C++ |
if(!self.define){const e=e=>{"require"!==e&&(e+=".js");let i=Promise.resolve();return r[e]||(i=new Promise((async i=>{if("document"in self){const r=document.createElement("script");r.src=e,document.head.appendChild(r),r.onload=i}else importScripts(e),i()}))),i.then((()=>{if(!r[e])throw new Error(`Module ${e} didn’t reg... | cwe | CWE-20 | JavaScript |
static int picolcd_raw_event(struct hid_device *hdev,
struct hid_report *report, u8 *raw_data, int size)
{
struct picolcd_data *data = hid_get_drvdata(hdev);
unsigned long flags;
int ret = 0;
if (!data)
return 1;
if (report->id == REPORT_KEY_STATE) {
if (data->input_keys)
ret = picolcd_raw_keypad(... | cwe | CWE-119 | C/C++ |
protected function _joinPath($dir, $name) {
$sql = 'SELECT id FROM '.$this->tbf.' WHERE parent_id="'.$dir.'" AND name="'.addslashes($name).'"';
$res = $this->query($sql);
if ($res && ($r = odbc_fetch_array($res))) {
$this->updateCache($r['id'], $this->_stat($r['id']));
return $r['id'];
}
return -1;
} | cwe | CWE-89 | JavaScript |
void Huff_offsetReceive (node_t *node, int *ch, byte *fin, int *offset) {
bloc = *offset;
while (node && node->symbol == INTERNAL_NODE) {
if (get_bit(fin)) {
node = node->right;
} else {
node = node->left;
}
}
if (!node) {
*ch = 0;
return;
// Com_Error(ERR_DROP, "Illegal tree!");
}
*ch = node->sy... | cwe | CWE-119 | C/C++ |
bool DependencyOptimizer::SafeToRemoveIdentity(const NodeDef& node) const {
if (!IsIdentity(node) && !IsIdentityN(node)) {
return true;
}
if (nodes_to_preserve_.find(node.name()) != nodes_to_preserve_.end()) {
return false;
}
if (!fetch_nodes_known_) {
// The output values of this node may be nee... | cwe | CWE-617 | C/C++ |
/* Listpack -- A lists of strings serialization format
*
* This file implements the specification you can find at:
*
* https://github.com/antirez/listpack
*
* Copyright (c) 2017, Salvatore Sanfilippo <antirez at gmail dot com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with ... | cwe | CWE-680 | C/C++ |
unsigned int GetU32BE (int nPos, bool *pbSuccess)
{
//*pbSuccess = true;
if ( nPos < 0 || nPos + 3 >= m_nLen )
{
*pbSuccess = false;
return 0;
}
unsigned int nRes = m_sFile[nPos];
nRes = (nRes << 8) + m_sFil... | cwe | CWE-787 | C/C++ |
def setup_cluster(params, request, session)
if not allowed_for_superuser(session)
return 403, 'Permission denied'
end
$logger.info("Setting up cluster: " + params.inspect)
nodes_rrp = params[:nodes].split(';')
options = []
myoptions = JSON.parse(params[:options])
transport_udp = false
options_udp = ... | cwe | CWE-384 | Ruby |
setup_arch (char **cmdline_p)
{
unw_init();
ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);
*cmdline_p = __va(ia64_boot_param->command_line);
strlcpy(boot_command_line, *cmdline_p, COMMAND_LINE_SIZE);
efi_init();
io_port_init();
#ifdef CONFIG_IA64_GENERIC
/* machvec needs to be... | cwe | CWE-119 | C/C++ |
public boolean add(MediaPackage sourceMediaPackage, AccessControlList acl, Date now) throws SolrServerException,
UnauthorizedException {
try {
SolrInputDocument episodeDocument = createEpisodeInputDocument(sourceMediaPackage, acl);
Schema.setOcModified(episodeDocument, now);
SolrInputDo... | cwe | CWE-863 | Java |
fb_mmap(struct file *file, struct vm_area_struct * vma)
{
struct fb_info *info = file_fb_info(file);
struct fb_ops *fb;
unsigned long off;
unsigned long start;
u32 len;
if (!info)
return -ENODEV;
if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
return -EINVAL;
off = vma->vm_pgoff << PAGE_SHIFT;
fb = info->fbops;... | cwe | CWE-189 | C/C++ |
void generate_inter_prediction_samples(base_context* ctx,
const slice_segment_header* shdr,
de265_image* img,
int xC,int yC,
int xB,int yB,
... | cwe | CWE-787 | Unknown |
# SPDX-License-Identifier: EUPL-1.2
# Copyright (C) 2019 - 2020 Dimpact
from decouple import Csv, config as _config, undefined
def config(option: str, default=undefined, *args, **kwargs):
if "split" in kwargs:
kwargs.pop("split")
kwargs["cast"] = Csv()
if default is not undefined and default ... | cwe | CWE-346 | Python |
#define UNP_READ_SIZE_MT 0x400000
#define UNP_BLOCKS_PER_THREAD 2
struct UnpackThreadDataList
{
UnpackThreadData *D;
uint BlockCount;
};
THREAD_PROC(UnpackDecodeThread)
{
UnpackThreadDataList *DL=(UnpackThreadDataList *)Data;
for (uint I=0;I<DL->BlockCount;I++)
DL->D->UnpackPtr->UnpackDe... | cwe | CWE-787 | C/C++ |
'use strict';
'require baseclass';
'require view';
'require fs';
'require ui';
var isReadonlyView = !L.hasViewPermission() || null;
var SSHPubkeyDecoder = baseclass.singleton({
lengthDecode: function(s, off)
{
var l = (s.charCodeAt(off++) << 24) |
(s.charCodeAt(off++) << 16) |
(s.charCodeAt(off++) << 8) ... | cwe | CWE-79 | JavaScript |
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
| Copyrigh... | cwe | CWE-119 | C/C++ |
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | cwe | CWE-476 | Python |
import base64
import re
from datetime import datetime
import logging
import ssl
from xml.etree import ElementTree
import iso8601
import six
import recurly
import recurly.errors
from recurly.link_header import parse_link_value
from six.moves import http_client
from six.moves.urllib.parse import urlencode, urljoin, url... | cwe | CWE-918 | Python |
static struct dst_entry *inet6_csk_route_socket(struct sock *sk,
struct flowi6 *fl6)
{
struct inet_sock *inet = inet_sk(sk);
struct ipv6_pinfo *np = inet6_sk(sk);
struct in6_addr *final_p, final;
struct dst_entry *dst;
memset(fl6, 0, sizeof(*fl6));
fl6->flowi6_proto = sk->sk_protocol;
fl6->daddr = sk->sk_... | cwe | CWE-264 | C/C++ |
static int llcp_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t len, int flags)
{
int noblock = flags & MSG_DONTWAIT;
struct sock *sk = sock->sk;
unsigned int copied, rlen;
struct sk_buff *skb, *cskb;
int err = 0;
pr_debug("%p %zu\n", sk, len);
msg->msg_namelen = 0;
l... | cwe | CWE-20 | Unknown |
/* Copyright (c) 2017 - 2021 LiteSpeed Technologies Inc. See LICENSE. */
/*
* echo_client.c -- This is really a "line client:" it connects to QUIC server
* and sends it stuff, line by line. It works in tandem with echo_server.
*/
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#inclu... | cwe | CWE-476 | C/C++ |
rfbTightExtensionClientClose(rfbClientPtr cl, void* data) {
if(data != NULL)
free(data);
} | cwe | CWE-416 | Unknown |
#!/usr/bin/env python
"""
Creates an HTTP server with basic auth and websocket communication.
"""
import argparse
import base64
import hashlib
import os
import time
import threading
import webbrowser
try:
import cStringIO as io
except ImportError:
import io
import tornado.web
import tornado.websocket
from tor... | cwe | CWE-522 | Python |
TypedValue HHVM_FUNCTION(substr_compare,
const String& main_str,
const String& str,
int offset,
int length /* = INT_MAX */,
bool case_insensitivity /* = false */) {
int s1_len = main_str.size()... | cwe | CWE-122 | C/C++ |
/*
* FreeRTOS Kernel V10.4.2
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* 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, includ... | cwe | CWE-190 | C/C++ |
function initialize() {
$("#tooltip-templates-container").html(render_tooltip_templates());
// Our default tooltip configuration. For this, one simply needs to:
// * Set `class="tippy-zulip-tooltip"` on an element for enable this.
// * Set `data-tippy-content="{{t 'Tooltip content' }}"`, often
// ... | cwe | CWE-79 | JavaScript |
#include "LogHandler.hpp"
INITIALIZE_EASYLOGGINGPP
namespace et {
el::Configurations LogHandler::setupLogHandler(int *argc, char ***argv) {
// easylogging parse verbose arguments, see [Application Arguments]
// in https://github.com/muflihun/easyloggingpp/blob/master/README.md
START_EASYLOGGINGPP(*argc, *argv);... | cwe | CWE-362 | C/C++ |
void Compute(OpKernelContext* ctx) override {
StagingMap<Ordered>* map = nullptr;
OP_REQUIRES_OK(ctx, GetStagingMap(ctx, def(), &map));
core::ScopedUnref scope(map);
typename StagingMap<Ordered>::OptionalTuple tuple;
const Tensor* key_tensor;
const Tensor* indices_tensor;
OpInputList values... | cwe | CWE-843 | C/C++ |
this.menus.tagsWindow=null);null!=this.menus.findWindow&&(this.menus.findWindow.window.setVisible(!1),this.menus.findWindow.window.destroy(),this.menus.findWindow=null);null!=this.menus.findReplaceWindow&&(this.menus.findReplaceWindow.window.setVisible(!1),this.menus.findReplaceWindow.window.destroy(),this.menus.findRe... | cwe | CWE-20 | JavaScript |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-125 | C/C++ |
transformCreateStmt(CreateStmt *stmt, const char *queryString)
{
ParseState *pstate;
CreateStmtContext cxt;
List *result;
List *save_alist;
ListCell *elements;
Oid namespaceid;
Oid existing_relid;
ParseCallbackState pcbstate;
/* Set up pstate */
pstate = make_parsestate(NULL);
pstate->p_sourcete... | cwe | CWE-94 | Unknown |
/* 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-20 | Python |
PJ_DEF(pj_status_t) pjmedia_rtcp_fb_build_pli(
pjmedia_rtcp_session *session,
void *buf,
pj_size_t *length)
{
pjmedia_rtcp_common *hdr;
unsigned len;
PJ_ASSERT_RETURN(session && buf && length, PJ_EINVAL);
len = 12;
if (len > *length)
return PJ_ETOOSMALL;
/* Build RTCP-FB PLI ... | cwe | CWE-787 | C/C++ |
static int rsi_send_beacon(struct rsi_common *common)
{
struct sk_buff *skb = NULL;
u8 dword_align_bytes = 0;
skb = dev_alloc_skb(MAX_MGMT_PKT_SIZE);
if (!skb)
return -ENOMEM;
memset(skb->data, 0, MAX_MGMT_PKT_SIZE);
dword_align_bytes = ((unsigned long)skb->data & 0x3f);
if (dword_align_bytes)
skb_pull(sk... | cwe | CWE-401 | C/C++ |
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// MIT License. See license.txt
// My HTTP Request
frappe.provide('frappe.request');
frappe.provide('frappe.request.error_handlers');
frappe.request.url = '/';
frappe.request.ajax_count = 0;
frappe.request.waiting_for_ajax = [];
frappe.request.logs... | cwe | CWE-79 | Python |
static SplineFont *SFD_GetFont( FILE *sfd,SplineFont *cidmaster,char *tok,
int fromdir, char *dirname, float sfdversion )
{
SplineFont *sf;
int realcnt, i, eof, mappos=-1, ch;
struct table_ordering *lastord = NULL;
struct axismap *lastaxismap = NULL;
struct named_instance *lastnamedinstance = NU... | cwe | CWE-416 | Unknown |
static struct mount *clone_mnt(struct mount *old, struct dentry *root,
int flag)
{
struct super_block *sb = old->mnt.mnt_sb;
struct mount *mnt;
int err;
mnt = alloc_vfsmnt(old->mnt_devname);
if (!mnt)
return ERR_PTR(-ENOMEM);
if (flag & (CL_SLAVE | CL_PRIVATE | CL_SHARED_TO_SLAVE))
mnt->mnt_group_id = ... | cwe | CWE-264 | C/C++ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.