code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
success: function(data) {
var inst = $.jstree.reference('#dataTree');
var remove = data.update.remove;
var childless = data.update.childless;
var removalClosure = [];
var unremovedParentClosure;
var removeType = function(type, ids) {
... | cwe | CWE-79 | JavaScript |
"""Abstract Apport user interface.
This encapsulates the workflow and common code for any user interface
implementation (like GTK, Qt, or CLI).
"""
# Copyright (C) 2007 - 2011 Canonical Ltd.
# Author: Martin Pitt <martin.pitt@ubuntu.com>
#
# This program is free software; you can redistribute it and/or modify it
# un... | cwe | CWE-269 | Python |
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholi... | cwe | CWE-190 | C/C++ |
package com.salesmanager.shop.admin.controller.products;
import com.salesmanager.core.business.services.catalog.category.CategoryService;
import com.salesmanager.core.business.services.catalog.product.ProductService;
import com.salesmanager.core.business.services.catalog.product.image.ProductImageService;
import com.s... | cwe | CWE-639 | Java |
doapr_outch(char **sbuffer,
char **buffer, size_t *currlen, size_t *maxlen, int c)
{
/* If we haven't at least one buffer, someone has doe a big booboo */
assert(*sbuffer != NULL || buffer != NULL);
/* |currlen| must always be <= |*maxlen| */
assert(*currlen <= *maxlen);
if (buffer && ... | cwe | CWE-119 | Unknown |
dissect_spoolss_keybuffer(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, dcerpc_info *di, guint8 *drep)
{
guint32 size;
int end_offset;
if (di->conformant_run)
return offset;
/* Dissect size and data */
offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
hf_keybuffer... | cwe | CWE-399 | C/C++ |
PJ_DEF(pj_status_t) pjmedia_rtcp_fb_parse_pli(
const void *buf,
pj_size_t length)
{
pjmedia_rtcp_common *hdr = (pjmedia_rtcp_common*) buf;
PJ_ASSERT_RETURN(buf, PJ_EINVAL);
if (length < 12)
return PJ_ETOOSMALL;
/* PLI uses pt==RTCP_PSFB and FMT==1 */
if (hdr->pt != RTCP_PSFB || hdr... | cwe | CWE-200 | Unknown |
MYSQL *mysql_connect_ssl_check(MYSQL *mysql_arg, const char *host,
const char *user, const char *passwd,
const char *db, uint port,
const char *unix_socket, ulong client_flag,
my_bool ssl_required... | cwe | CWE-319 | Unknown |
static int install_thread_keyring(void)
{
struct cred *new;
int ret;
new = prepare_creds();
if (!new)
return -ENOMEM;
BUG_ON(new->thread_keyring);
ret = install_thread_keyring_to_cred(new);
if (ret < 0) {
abort_creds(new);
return ret;
}
return commit_creds(new);
} | cwe | CWE-404 | Unknown |
int main(int argc, char *argv[])
{
libettercap_init();
ef_globals_alloc();
select_text_interface();
libettercap_ui_init();
/* etterfilter copyright */
fprintf(stdout, "\n" EC_COLOR_BOLD "%s %s" EC_COLOR_END " copyright %s %s\n\n",
PROGRAM, EC_VERSION, EC_COPYRIGHT, EC_AUTHORS);
... | cwe | CWE-703 | Unknown |
TfLiteStatus ResizeOutputandTemporaryTensors(TfLiteContext* context,
TfLiteNode* node) {
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
const int num_dims = NumDimensions(input);
TF_LITE_ENSURE(context, num_dims >= 2);
const TfLiteTensor* fft_leng... | cwe | CWE-125 | C/C++ |
unsigned char *base64decode(const char *buf, size_t *size)
{
if (!buf || !size) return NULL;
size_t len = (*size > 0) ? *size : strlen(buf);
if (len <= 0) return NULL;
unsigned char *outbuf = (unsigned char*)malloc((len/4)*3+3);
const char *ptr = buf;
int p = 0;
size_t l = 0;
do {
ptr += strspn(ptr, "\r\n\t ... | cwe | CWE-125 | C/C++ |
/**
* OLAT - Online Learning and Training<br>
* http://www.olat.org
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unl... | cwe | CWE-91 | Java |
/*
* History:
* Started: Aug 9 by Lawrence Foard (entropy@world.std.com),
* to allow user process control of SCSI devices.
* Development Sponsored by Killy Corp. NY NY
*
* Original driver (sg.c):
* Copyright (C) 1992 Lawrence Foard
* Version 2 and 3 extensions to driver:
* Copyright ... | cwe | CWE-415 | C/C++ |
send(mail, done) {
// Sendmail strips this header line by itself
mail.message.keepBcc = true;
let envelope = mail.data.envelope || mail.message.getEnvelope();
let messageId = mail.message.messageId();
let args;
let sendmail;
let returned;
let transform;
... | cwe | CWE-88 | JavaScript |
void FileAPIMessageFilter::OnCreateSnapshotFile(
int request_id, const GURL& blob_url, const GURL& path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
FileSystemURL url(path);
base::Callback<void(const FilePath&)> register_file_callback =
base::Bind(&FileAPIMessageFilter::RegisterFileAsBlo... | cwe | CWE-264 | C/C++ |
/*
* crun - OCI runtime written in C
*
* Copyright (C) 2017, 2018, 2019 Giuseppe Scrivano <giuseppe@scrivano.org>
* crun 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; either version 2 of the License, o... | cwe | CWE-276 | C/C++ |
BGD_DECLARE(void) gdImageWebp (gdImagePtr im, FILE * outFile)
{
gdIOCtx *out = gdNewFileCtx(outFile);
if (out == NULL) {
return;
}
gdImageWebpCtx(im, out, -1);
out->gd_free(out);
} | cwe | CWE-415 | Unknown |
def get_secrets(self, from_date_added=0):
secrets = []
for row in self.cursor.execute('SELECT encrypted, json_id, date_added FROM secret WHERE date_added > %s ORDER BY date_added DESC' % from_date_added):
aes_key, json_id, date_added = cryptlib.eciesDecrypt(row[0], self.privkey), row[1], row[2]
if aes_key != ... | cwe | CWE-89 | Python |
set_acl(struct archive *a, int fd, const char *name,
struct archive_acl *abstract_acl,
int ae_requested_type, const char *tname)
{
int acl_type = 0;
int ae_type, ae_permset, ae_tag, ae_id;
uid_t ae_uid;
gid_t ae_gid;
const char *ae_name;
int entries;
int i;
int ret;
acl_t acl = NULL;
a... | cwe | CWE-61 | Unknown |
static int __ipmi_bmc_register(struct ipmi_smi *intf,
struct ipmi_device_id *id,
bool guid_set, guid_t *guid, int intf_num)
{
int rv;
struct bmc_device *bmc;
struct bmc_device *old_bmc;
/*
* platform_device_register() can cause bmc_reg_mutex to
* be claimed because of the is_v... | cwe | CWE-401 | Unknown |
PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER)
{
const unsigned char *cursor, *limit, *marker, *start;
zval **rval_ref;
limit = max;
cursor = *p;
if (YYCURSOR >= YYLIMIT) {
return 0;
}
if (var_hash && cursor[0] != 'R') {
var_push(var_hash, rval);
}
start = cursor;
#line 496 "ext/standard/var... | cwe | CWE-125 | Unknown |
import configparser
from flask import Flask, render_template, session, request, flash, redirect, url_for, Response, abort, jsonify, send_file
import socket
import os
import random
import copy
from flask_sqlalchemy import SQLAlchemy, Model
import gspread
from oauth2client.service_account import ServiceAccountCredential... | cwe | CWE-22 | Python |
urlParams.sketch?3:48)));this.getX()==U&&this.getY()==X||mxWindow.prototype.setLocation.apply(this,arguments)};var V=mxUtils.bind(this,function(){var U=this.window.getX(),X=this.window.getY();this.window.setLocation(U,X)});mxEvent.addListener(window,"resize",V);this.destroy=function(){mxEvent.removeListener(window,"res... | cwe | CWE-94 | JavaScript |
void PeerListWidget::updatePeer(const QString &ip, BitTorrent::TorrentHandle *const torrent, const BitTorrent::PeerInfo &peer)
{
QStandardItem *item = m_peerItems.value(ip);
int row = item->row();
if (m_resolveCountries) {
const QIcon ico = GuiIconProvider::instance()->getFlagIcon(peer.country());
... | cwe | CWE-20 | Unknown |
static int proc_connectinfo(struct usb_dev_state *ps, void __user *arg)
{
struct usbdevfs_connectinfo ci = {
.devnum = ps->dev->devnum,
.slow = ps->dev->speed == USB_SPEED_LOW
};
if (copy_to_user(arg, &ci, sizeof(ci)))
return -EFAULT;
return 0;
} | cwe | CWE-200 | C/C++ |
int con_font_op(struct vc_data *vc, struct console_font_op *op)
{
switch (op->op) {
case KD_FONT_OP_SET:
return con_font_set(vc, op);
case KD_FONT_OP_GET:
return con_font_get(vc, op);
case KD_FONT_OP_SET_DEFAULT:
return con_font_default(vc, op);
case KD_FONT_OP_COPY:
return con_font_copy(vc, op);
}
retur... | cwe | CWE-125 | Unknown |
public function saveOption(Request $request) {
$cleanFromXss = true;
$option = $request->all();
// Allow for this keys
if (isset($option['option_key'])) {
if ($option['option_key'] == 'website_head') {
$cleanFromXss = false;
}
if ($op... | cwe | CWE-79 | PHP |
static int ovl_fill_super(struct super_block *sb, void *data, int silent)
{
struct path lowerpath;
struct path upperpath;
struct path workpath;
struct inode *root_inode;
struct dentry *root_dentry;
struct ovl_entry *oe;
struct ovl_fs *ufs;
struct kstatfs statfs;
int err;
err = -ENOMEM;
ufs = kzalloc(sizeof(... | cwe | CWE-264 | C/C++ |
void InstallablePaymentAppCrawler::OnPaymentMethodManifestParsed(
const GURL& method_manifest_url,
const std::vector<GURL>& default_applications,
const std::vector<url::Origin>& supported_origins,
bool all_origins_supported) {
number_of_payment_method_manifest_to_parse_--;
if (web_contents() == nul... | cwe | CWE-79 | C/C++ |
unsigned long long qpdf_get_error_file_position(qpdf_data qpdf, qpdf_error e)
{
if (e == 0)
{
return 0;
}
return e->exc->getFilePosition();
} | cwe | CWE-787 | Unknown |
/*
* Copyright (c) 2004-2021, University of Oslo
* 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
* list of cond... | cwe | CWE-89 | Java |
unsigned long perf_instruction_pointer(struct pt_regs *regs)
{
bool use_siar = regs_use_siar(regs);
unsigned long siar = mfspr(SPRN_SIAR);
if (ppmu->flags & PPMU_P10_DD1) {
if (siar)
return siar;
else
return regs->nip;
} else if (use_siar && siar_valid(regs))
return mfspr(SPRN_SIAR) + perf_ip_adjust(re... | cwe | CWE-476 | C/C++ |
# Copyright 2022, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | cwe | CWE-77 | Python |
function buildHttpOptions(installerfileURL)
{
var options = {
host: url.parse(installerfileURL).host,
port: 80,
path: url.parse(installerfileURL).pathname
};
var proxyStr;
var child = exec('npm config get proxy', function(error, st... | cwe | CWE-310 | JavaScript |
String preg_quote(const String& str,
const String& delimiter /* = null_string */) {
const char* in_str = str.data();
const char* in_str_end = in_str + str.size();
/* Nothing to do if we got an empty string */
if (in_str == in_str_end) {
return str;
}
char delim_char = 0; /* Deli... | cwe | CWE-190 | C/C++ |
create_surface_from_thumbnail_data (guchar *data,
gint width,
gint height,
gint rowstride)
{
guchar *cairo_pixels;
cairo_surface_t *surface;
static cairo_user_data_key_t key;
int j;
cairo_pixels = (guchar *)g_malloc (4 * width * height);
surface = cairo_image_surface_... | cwe | CWE-189 | C/C++ |
spnego_gss_verify_mic(
OM_uint32 *minor_status,
const gss_ctx_id_t context_handle,
const gss_buffer_t msg_buffer,
const gss_buffer_t token_buffer,
gss_qop_t *qop_state)
{
OM_uint32 ret;
ret = gss_verify_mic(minor_status,
context_handle,
msg_buffer,
token_buffer,
qop_state);
retu... | cwe | CWE-763 | C/C++ |
pg_open_tzfile(const char *name, char *canonname)
{
char fullname[MAXPGPATH];
if (canonname)
strlcpy(canonname, name, TZ_STRLEN_MAX + 1);
strcpy(fullname, pg_TZDIR());
if (strlen(fullname) + 1 + strlen(name) >= MAXPGPATH)
return -1; /* not gonna fit */
strcat(fullname, "/");
strcat(fullname, name);
re... | cwe | CWE-119 | Unknown |
func ServerDefault(ops ...func(*tls.Config)) *tls.Config {
tlsconfig := &tls.Config{
// Avoid fallback by default to SSL protocols < TLS1.0
MinVersion: tls.VersionTLS10,
PreferServerCipherSuites: true,
CipherSuites: DefaultServerAcceptedCiphers,
}
for _, op := range ops {
op(tlsc... | cwe | CWE-327 | Go |
set: function (key, val) {
if (val === undefined) {
val = key;
key = null;
}
var path = getPath(key);
if (path.length === 0) {
// root must be an object
if (!val || typeof val !== 'object') {
return false;
} else {
this.store = val;
return true;
... | cwe | CWE-915 | JavaScript |
function addDiscountToCart() {
// global $user, $order;
global $order;
//lookup discount to see if it's real and valid, and not already in our cart
//this will change once we allow more than one coupon code
$discount = new discounts();
$discount = $discount->getCouponByNa... | cwe | CWE-89 | PHP |
import { FlowRouter } from 'meteor/ostrio:flow-router-extra'
import './projectAccessRights.html'
import { t, i18nReady } from '../../utils/i18n.js'
import {
validateEmail, getGlobalSetting, showToast,
} from '../../utils/frontend_helpers'
import Projects from '../../api/projects/projects.js'
Template.projectAccessRi... | cwe | CWE-79 | JavaScript |
bool WddxPacket::recursiveAddVar(const String& varName,
const Variant& varVariant,
bool hasVarTag) {
bool isArray = varVariant.isArray();
bool isObject = varVariant.isObject();
if (isArray || isObject) {
if (hasVarTag) {
m_packetString ... | cwe | CWE-79 | C/C++ |
static void tg3_read_vpd(struct tg3 *tp)
{
u8 *vpd_data;
unsigned int block_end, rosize, len;
u32 vpdlen;
int j, i = 0;
vpd_data = (u8 *)tg3_vpd_readblock(tp, &vpdlen);
if (!vpd_data)
goto out_no_vpd;
i = pci_vpd_find_tag(vpd_data, 0, vpdlen, PCI_VPD_LRDT_RO_DATA);
if (i < 0)
goto out_not_found;
rosize ... | cwe | CWE-119 | C/C++ |
def sendEmail(sydent, templateName, mailTo, substitutions):
mailFrom = sydent.cfg.get('email', 'email.from')
mailTemplateFile = sydent.cfg.get('email', templateName)
myHostname = sydent.cfg.get('email', 'email.hostname')
if myHostname == '':
myHostname = socket.getfqdn()
... | cwe | CWE-20 | Python |
GC_allochblk_nth(size_t sz, int kind, unsigned flags, int n, int may_split)
{
struct hblk *hbp;
hdr * hhdr; /* Header corr. to hbp */
struct hblk *thishbp;
hdr * thishdr; /* Header corr. to thishbp */
signed_word size_needed; /* number of bytes in requested objects */... | cwe | CWE-119 | Unknown |
ocsp_load_response(SSL_CTX *sctx, tls_ext_ctx_cb *cbinfo, const uschar *expanded)
{
BIO *bio;
OCSP_RESPONSE *resp;
OCSP_BASICRESP *basic_response;
OCSP_SINGLERESP *single_response;
ASN1_GENERALIZEDTIME *rev, *thisupd, *nextupd;
X509_STORE *store;
unsigned long verify_flags;
int status, reason, i;
cbinfo->u_ocsp.server... | cwe | CWE-264 | Unknown |
static int check_ptr_alignment(struct bpf_verifier_env *env,
const struct bpf_reg_state *reg,
int off, int size)
{
bool strict = env->strict_alignment;
const char *pointer_desc = "";
switch (reg->type) {
case PTR_TO_PACKET:
case PTR_TO_PACKET_META:
/* Special case, because of NET_IP_ALIGN. G... | cwe | CWE-119 | C/C++ |
static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
struct ipddp_route __user *rt = ifr->ifr_data;
struct ipddp_route rcp, rcp2, *rp;
if(!capable(CAP_NET_ADMIN))
return -EPERM;
if(copy_from_user(&rcp, rt, sizeof(rcp)))
return -EFAULT;
switch... | cwe | CWE-200 | C/C++ |
OJPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
(void)s;
if (sp->libjpeg_jpeg_query_style==0)
{
if (OJPEGDecodeRaw(tif,buf,cc)==0)
return(0);
}
else
{
if (OJPEGDecodeScanlines(tif,buf,cc)==0)
return(0);
}
return(1);
} | cwe | CWE-369 | C/C++ |
/* Copyright 2020 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 | C/C++ |
static Image *ReadTIFFImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
#define ThrowTIFFException(severity,message) \
{ \
if (pixel_info != (MemoryInfo *) NULL) \
pixel_info=RelinquishVirtualMemory(pixel_info); \
if (quantum_info != (QuantumInfo *) NULL) \
quantum_info=DestroyQuantumInfo(qua... | cwe | CWE-703 | Unknown |
int fscrypt_setup_filename(struct inode *dir, const struct qstr *iname,
int lookup, struct fscrypt_name *fname)
{
int ret = 0, bigname = 0;
memset(fname, 0, sizeof(struct fscrypt_name));
fname->usr_fname = iname;
if (!dir->i_sb->s_cop->is_encrypted(dir) ||
fscrypt_is_dot_dotdot(iname)) {
fname->dis... | cwe | CWE-416 | Unknown |
cnt_recv_prep(struct req *req, const char *ci)
{
const char *xff;
if (req->restarts == 0) {
/*
* This really should be done earlier, but we want to capture
* it in the VSL log.
*/
http_CollectHdr(req->http, H_X_Forwarded_For);
if (http_GetHdr(req->http, H_X_Forwarded_For, &xff)) {
http_Unset(req->h... | cwe | CWE-212 | C/C++ |
function URLEscape( $string )
{
$string = preg_replace_callback(
// Match both decimal & hex code (although hex codes can contain a-f letters).
// Should be enough as the alphabet hex codes only have numbers.
"/(&#x?[0-9]+;?)/i",
function( $match ) {
if ( mb_substr( $match[1], -1 ) !== ';' )
{
// Fix... | cwe | CWE-79 | PHP |
static int xbuf_format_converter(char **outbuf, const char *fmt, va_list ap)
{
register char *s = nullptr;
char *q;
int s_len;
register int min_width = 0;
int precision = 0;
enum {
LEFT, RIGHT
} adjust;
char pad_char;
char prefix_char;
double fp_num;
wide_int i_num = (wide_int) 0;
u_wide_i... | cwe | CWE-190 | C/C++ |
horizontalDifference16(unsigned short *ip, int n, int stride,
unsigned short *wp, uint16 *From14)
{
register int r1, g1, b1, a1, r2, g2, b2, a2, mask;
/* assumption is unsigned pixel values */
#undef CLAMP
#define CLAMP(v) From14[(v) >> 2]
mask = CODE_MASK;
if (n >= stride) {
if (stride == 3) {
... | cwe | CWE-119 | C/C++ |
int llhttp_message_needs_eof(const llhttp_t* parser) {
if (parser->type == HTTP_REQUEST) {
return 0;
}
/* See RFC 2616 section 4.4 */
if (parser->status_code / 100 == 1 || /* 1xx e.g. Continue */
parser->status_code == 204 || /* No Content */
parser->status_code == 304 || /* Not Modifie... | cwe | CWE-444 | Unknown |
/****************************************************************
* 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... | cwe | CWE-862 | Java |
App.Actions.WEB.update_custom_doc_root = function(elm, hint) {
var prepath = $('input[name="v-custom-doc-root_prepath"]').val();
var domain = $('select[name="v-custom-doc-domain"]').val();
var folder = $('input[name="v-custom-doc-folder"]').val();
console.log(domain, folder);
$('.custom_docroot_hint... | cwe | CWE-79 | JavaScript |
WebstoreBindings::WebstoreBindings(ScriptContext* context)
: ObjectBackedNativeHandler(context) {
RouteFunction("Install",
base::Bind(&WebstoreBindings::Install, base::Unretained(this)));
} | cwe | CWE-254 | C/C++ |
tcp_sack_option(struct tcpcb *tp, struct tcphdr *th, u_char *cp, int optlen)
{
int tmp_olen;
u_char *tmp_cp;
struct sackhole *cur, *p, *temp;
if (!tp->sack_enable)
return;
/* SACK without ACK doesn't make sense. */
if ((th->th_flags & TH_ACK) == 0)
return;
/* Make sure the ACK on this segment is in [s... | cwe | CWE-20 | C/C++ |
static CURLcode ossl_connect_step1(struct Curl_easy *data,
struct connectdata *conn, int sockindex)
{
CURLcode result = CURLE_OK;
char *ciphers;
SSL_METHOD_QUAL SSL_METHOD *req_method = NULL;
X509_LOOKUP *lookup = NULL;
curl_socket_t sockfd = conn->sock[sockindex];
struct ... | cwe | CWE-295 | Unknown |
void jbd2_journal_wait_updates(journal_t *journal)
{
transaction_t *commit_transaction = journal->j_running_transaction;
if (!commit_transaction)
return;
spin_lock(&commit_transaction->t_handle_lock);
while (atomic_read(&commit_transaction->t_updates)) {
DEFINE_WAIT(wait);
prepare_to_wait(&journal->j_wait_... | cwe | CWE-416 | C/C++ |
validate_commit_metadata (GVariant *commit_data,
const char *ref,
const char *required_metadata,
gboolean require_xa_metadata,
GError **error)
{
g_autoptr(GVariant) commit_metadata = NULL;
const char *xa_me... | cwe | CWE-269 | C/C++ |
int wolfSSH_SFTP_RecvWrite(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
#ifndef USE_WINDOWS_API
{
WFD fd;
word32 sz;
int ret = WS_SUCCESS;
word32 idx = 0;
word32 ofst[2] = {0,0};
word32 outSz = 0;
byte* out = NULL;
char suc[] = "Write File Success";
char err[] = ... | cwe | CWE-190 | Unknown |
Compute(OpKernelContext* context, bool sorted, int k,
const typename TTypes<T, 2>::ConstTensor& input, const int64 num_rows,
const int64 num_cols, typename TTypes<T, 2>::Tensor values,
typename TTypes<int, 2>::Tensor indices) {
const CPUDevice& d = context->eigen_device<CPUDevice>();
... | cwe | CWE-703 | Unknown |
#!/usr/bin/python3
import threading
import gettext
import math
import logging
import os
from pathlib import Path
import queue
import sys
import socket
import time
import traceback
from concurrent.futures import ThreadPoolExecutor
from gi.repository import GLib, Gtk, Gdk, GObject, GdkPixbuf, Gio
import prefs
import c... | cwe | CWE-22 | Python |
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chrome_content_browser_client.h"
#include <map>
#include <set>
#include <utility>
#include <vector>
#include "base/base_swi... | cwe | CWE-362 | C/C++ |
tgs_build_reply(krb5_context context,
krb5_kdc_configuration *config,
KDC_REQ *req,
KDC_REQ_BODY *b,
hdb_entry_ex *krbtgt,
krb5_enctype krbtgt_etype,
const krb5_keyblock *replykey,
int rk_is_subkey,
krb5_ticket *ticket,
krb5_data *reply,
const char *from,
const char **e_text,
AuthorizationData *... | cwe | CWE-295 | Unknown |
private BigInteger validate(BigInteger y, DHParameters dhParams)
{
if (dhParams.getQ() != null)
{
if (BigInteger.ONE.equals(y.modPow(dhParams.getQ(), dhParams.getP())))
{
return y;
}
throw new IllegalArgumentException("Y value does not... | cwe | CWE-320 | Java |
void FdOutStream::flush()
{
while (sentUpTo < ptr) {
int n = writeWithTimeout((const void*) sentUpTo,
ptr - sentUpTo,
blocking? timeoutms : 0);
// Timeout?
if (n == 0) {
// If non-blocking then we're done here
if (!blocking)
br... | cwe | CWE-787 | C/C++ |
begin_softmask(fz_context *ctx, pdf_run_processor *pr, softmask_save *save)
{
pdf_gstate *gstate = pr->gstate + pr->gtop;
pdf_xobject *softmask = gstate->softmask;
fz_rect mask_bbox;
fz_matrix tos_save[2], save_ctm;
fz_matrix mask_matrix;
fz_colorspace *mask_colorspace;
save->softmask = softmask;
if (softmask ... | cwe | CWE-416 | C/C++ |
function(){k.checked&&(null==g||g.checked)?q.removeAttribute("disabled"):q.setAttribute("disabled","disabled")}));mxUtils.br(d);return{getLink:function(){return k.checked?"blank"===q.value?"_blank":p:null},getEditInput:function(){return k},getEditSelect:function(){return q}}};EditorUi.prototype.addLinkSection=function(... | cwe | CWE-94 | JavaScript |
function zoomSlide(slideNumber, podId, widthRatio, heightRatio, x, y) {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'ResizeAndMovePagePubMsg';
try {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
chec... | cwe | CWE-918 | JavaScript |
_libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel,
const char *request, size_t request_len,
const char *message, size_t message_len)
{
LIBSSH2_SESSION *session = channel->session;
unsigned char *s;
static const unsigned char reply_cod... | cwe | CWE-787 | Unknown |
static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode,
struct nameidata *nd)
{
struct jffs2_raw_inode *ri;
struct jffs2_inode_info *f, *dir_f;
struct jffs2_sb_info *c;
struct inode *inode;
int ret;
ri = jffs2_alloc_raw_inode();
return -ENOMEM;
c =... | cwe | CWE-264 | C/C++ |
var T=document.createElement("tbody"),P=(new Date).toDateString();null!=b.currentPage&&null!=b.pages&&(g=mxUtils.indexOf(b.pages,b.currentPage));for(q=e.length-1;0<=q;q--){var Q=function(S){var Y=new Date(S.modifiedDate),ba=null;if(0<=Y.getTime()){var da=function(ja){x.stop();v.innerHTML="";var ea=mxUtils.parseXml(ja),... | cwe | CWE-94 | JavaScript |
PostgreSQL.prototype.buildExpression = function(columnName, operator,
operatorValue, propertyDefinition) {
switch (operator) {
case 'like':
return new ParameterizedSQL(columnName + "::TEXT LIKE ? ESCAPE E'\\\\'",
[operatorValue]);
case 'ilike':
return new ParameterizedSQL(columnName + ":... | cwe | CWE-89 | JavaScript |
from pathlib import Path
import sys
import os
import elasticsearch
import yaml
from elasticsearch import Elasticsearch
from flask import current_app, g
from tinydb import TinyDB, Query, operations
from archivy.config import BaseHooks, Config
def load_config(path=""):
"""Loads `config.yml` file safely and deseri... | cwe | CWE-601 | Python |
static ssize_t stellaris_enet_receive(NetClientState *nc, const uint8_t *buf, size_t size)
{
stellaris_enet_state *s = qemu_get_nic_opaque(nc);
int n;
uint8_t *p;
uint32_t crc;
if ((s->rctl & SE_RCTL_RXEN) == 0)
return -1;
if (s->np >= 31) {
return 0;
}
DPRINTF("Receive... | cwe | CWE-20 | Unknown |
String.prototype.escapeHTML = function(){
/*
HTML Escape Before Inserting Untrusted Data into HTML Element Content
https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention
_Cheat_Sheet#RULE_.231_-_HTML_Escape_Before_Inserting_Untrusted_Data_into
_HTML_Element_Content
*/
var ... | cwe | CWE-116 | JavaScript |
static void chrc_write_cb(struct gatt_db_attribute *attrib,
unsigned int id, uint16_t offset,
const uint8_t *value, size_t len,
uint8_t opcode, struct bt_att *att,
void *user_data)
{
struct external_chrc *chrc = user_data;
struct btd_device *device;
struct queue *queue;
DBusMessageIter iter;
i... | cwe | CWE-416 | Unknown |
cJSON *cJSON_CreateFalse( void )
{
cJSON *item = cJSON_New_Item();
if ( item )
item->type = cJSON_False;
return item;
} | cwe | CWE-120 | C/C++ |
int nfc_enable_se(struct nfc_dev *dev, u32 se_idx)
{
struct nfc_se *se;
int rc;
pr_debug("%s se index %d\n", dev_name(&dev->dev), se_idx);
device_lock(&dev->dev);
if (!device_is_registered(&dev->dev)) {
rc = -ENODEV;
goto error;
}
if (!dev->dev_up) {
rc = -ENODEV;
goto error;
}
if (dev->polling) {... | cwe | CWE-416 | Unknown |
static NO_INLINE JsVar *jspGetNamedFieldInParents(JsVar *object, const char* name, bool returnName) {
// Now look in prototypes
JsVar * child = jspeiFindChildFromStringInParents(object, name);
/* Check for builtins via separate function
* This way we save on RAM for built-ins because everything comes out of p... | cwe | CWE-787 | Unknown |
def get_valid_filename(value, replace_whitespace=True, chars=128):
"""
Returns the given string converted to a string that can be used for a clean
filename. Limits num characters to 128 max.
"""
if value[-1:] == u'.':
value = value[:-1]+u'_'
value = value.replace("/", "_").replace(":", "... | cwe | CWE-918 | Python |
int test_curve(int c) {
spiro_cp spiro[16];
int nextknot[17];
double d[5];
spiro_seg *segs = NULL;
bezctx *bc;
rs_check_vals *rsp;
int i,j,done;
/* Load sample data so that we can see if library is callable */
load_test_curve(spiro,nextknot,c);
d[0] = 1.; d[1] = d[1] = 0.;
#if ... | cwe | CWE-787 | C/C++ |
static MagickBooleanType EncodeImage(const ImageInfo *image_info,Image *image,
const size_t data_size)
{
#define MaxCode(number_bits) ((one << (number_bits))-1)
#define MaxHashTable 5003
#define MaxGIFBits 12UL
#define MaxGIFTable (1UL << MaxGIFBits)
#define GIFOutputCode(code) \
{ \
/* \
Emit a code. \
... | cwe | CWE-119 | Unknown |
static Image *ReadJPEGImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
char
value[MaxTextExtent];
const char
*option;
ErrorManager
error_manager;
Image
*image;
IndexPacket
index;
JSAMPLE
*volatile jpeg_pixels;
JSAMPROW
scanline[1];
MagickBooleanType
... | cwe | CWE-200 | Unknown |
public void sendError(int sc, String msg) throws IOException {
if (isIncluding()) {
Logger.log(Logger.ERROR, Launcher.RESOURCES, "IncludeResponse.Error",
new String[] { "" + sc, msg });
return;
}
Logger.log(Logger.DEBUG, Launcher.RESOURCES,
... | cwe | CWE-79 | Java |
#!/usr/bin/env python
'''
MIT License
Copyright (c) 2019 Tenable Network Security, Inc.
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 right... | cwe | CWE-502 | Python |
package ping
import (
"bytes"
"context"
"errors"
"io"
"time"
u "github.com/ipfs/go-ipfs-util"
logging "github.com/ipfs/go-log/v2"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
)
var log = logging.Logger("ping")
const PingSize = 3... | cwe | CWE-400 | Go |
function upgradeWebSocket(request, options = {}) {
const upgrade = request.headers.get("upgrade");
const upgradeHasWebSocketOption = upgrade !== null &&
ArrayPrototypeSome(
StringPrototypeSplit(upgrade, /\s*,\s*/),
(option) => StringPrototypeToLowerCase(option) === "websocket",
);
if (!upgrade... | cwe | CWE-1333 | JavaScript |
def vote(request, pk):
# TODO: check if user has access to this topic/poll
poll = get_object_or_404(
CommentPoll.objects.unremoved(),
pk=pk
)
if not request.user.is_authenticated:
return redirect_to_login(next=poll.get_absolute_url())
form = PollVoteManyForm(user=request.us... | cwe | CWE-601 | Python |
static void lcbio_cache_local_name(lcbio_CONNINFO *sock)
{
switch (sock->sa_local.ss_family) {
case AF_INET: {
auto *addr = (struct sockaddr_in *)&sock->sa_local;
inet_ntop(AF_INET, &(addr->sin_addr), sock->ep_local, sizeof(sock->ep_local));
size_t len = strlen(sock->ep_l... | cwe | CWE-119 | C/C++ |
def AsyncGetActionAllowAnyone(f: GetRequest => Future[Result]): mvc.Action[Unit] =
PlainApiAction(cc.parsers.empty, NoRateLimits, allowAnyone = true).async(f) | cwe | CWE-613 | Scala |
"use strict";
var fs = require('fs');
var path = require('path');
var async = require('async');
var child_process = require('child_process');
var fsPath = {
_win32: process.platform === 'win32',
_supportExecSync: function () {
if (!child_process.execSync) {
throw new Error('your node.js version is to low... | cwe | CWE-77 | JavaScript |
package registry
import (
"context"
"encoding/base64"
"fmt"
"net"
"net/url"
"strings"
"time"
"github.com/pomerium/pomerium/config"
"github.com/pomerium/pomerium/internal/log"
"github.com/pomerium/pomerium/pkg/grpc"
pb "github.com/pomerium/pomerium/pkg/grpc/registry"
"github.com/cenkalti/backoff/v4"
)
//... | cwe | CWE-200 | Go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.