code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
/** @file
HTTP state machine
@section license License
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the... | vuln | Safe | C/C++ |
static void cliRefreshPrompt(void) {
if (config.eval_ldb) return;
sds prompt = sdsempty();
if (config.hostsocket != NULL) {
prompt = sdscatfmt(prompt,"redis %s",config.hostsocket);
} else {
char addr[256];
anetFormatAddr(addr, sizeof(addr), config.hostip, config.hostport);
... | vuln | Safe | Unknown |
PrintMsg_Print_Params::PrintMsg_Print_Params()
: page_size(),
content_size(),
printable_area(),
margin_top(0),
margin_left(0),
dpi(0),
min_shrink(0),
max_shrink(0),
desired_dpi(0),
document_cookie(0),
selection_only(false),
supports_alpha_blend(false),
preview_ui_add... | cwe | CWE-200 | C/C++ |
def set_image
Log.add_info(request, params.inspect)
created = false
if params[:id].nil? or params[:id].empty?
@item = Item.new_info(0)
@item.attributes = params[:item]
@item.user_id = @login_user.id
@item.title = t('paren.no_title')
[:image0, :image1].each do |img|
... | vuln | Vulnerable | Ruby |
static void swap_channel_layouts_on_filter(AVFilterContext *filter)
{
AVFilterLink *link = NULL;
int i, j, k;
for (i = 0; i < filter->nb_inputs; i++) {
link = filter->inputs[i];
if (link->type == AVMEDIA_TYPE_AUDIO &&
link->out_channel_layouts->nb_channel_layouts == 1)
... | vuln | Safe | C/C++ |
public char charAt(int line, int column) {
if(!checkLineAndColumn(line, column, true)) return 0;
if (column == getColumnCount(line)) {
return '\n';
}
return mLines.get(line).charAt(column);
} | vuln | Safe | Java |
void operator()(OpKernelContext* ctx, const Index num_segments,
const TensorShape& segment_ids_shape,
typename TTypes<Index>::ConstFlat segment_ids,
const Index data_size, const T* data,
typename TTypes<T, 2>::Tensor output) {
output.setConstan... | cwe | CWE-122 | C/C++ |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% M M AAA TTTTT L AAA BBBB ... | cwe | CWE-20 | C/C++ |
private void onActionMove(TupleMessageEx message, final boolean copy, long account, long[] disabled) {
Bundle args = new Bundle();
args.putString("title", context.getString(copy ? R.string.title_copy_to : R.string.title_move_to_folder));
args.putLong("account", account);
... | vuln | Vulnerable | Java |
rfbProcessClientNormalMessage(rfbClientPtr cl)
{
int n=0;
rfbClientToServerMsg msg;
char *str;
int i;
uint32_t enc=0;
uint32_t lastPreferredEncoding = -1;
char encBuf[64];
char encBuf2[64];
#ifdef LIBVNCSERVER_WITH_WEBSOCKETS
if (cl->wsctx && webSocketCheckDisconnect(cl))
retu... | cwe | CWE-189 | C/C++ |
"12px";var ka=X.getRealtimeError();X=X.getRealtimeState();var ja=mxResources.get("realtimeCollaboration");1==X?(ea.src=Editor.syncImage,ja+=" ("+mxResources.get("online")+")"):(ea.src=Editor.syncProblemImage,ja=null!=ka&&null!=ka.message?ja+(" ("+ka.message+")"):ja+(" ("+mxResources.get("disconnected")+")"));ea.setAttr... | cwe | CWE-94 | JavaScript |
function AddonText_Selection_create() {
var presenter = function() {};
presenter.eventBus = null;
presenter.playerController = null;
presenter.textParser = null;
presenter.selected_elements = null;
presenter.isWorkMode = true;
presenter.markedMathJaxContent = [];
presenter.areAllPhrase... | vuln | Vulnerable | JavaScript |
private def createSessionId(siteId: SiteId, userId: UserId): SidOk = {
// For now, create a SID value and *parse* it to get a SidOk.
// This is stupid and inefficient.
val now = globals.now()
val uid = "" // for now
val useridDateRandom =
userId +"."+
now.millis +"."+
(nex... | cwe | CWE-613 | Scala |
/* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
* Copyright (c) 2016 Facebook
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in th... | cwe | CWE-190 | C/C++ |
/*
* Copyright (c) 2019-2021 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy,... | vuln | Safe | Java |
static void sfb_init_perturbation(u32 slot, struct sfb_sched_data *q)
{
q->bins[slot].perturbation = prandom_u32();
} | cwe | CWE-330 | Unknown |
def vault_encrypt(v_plaintexts, mp):
iv = '01234567'
vault_code = vault_encode(v_plaintexts, mp)
des3 = DES3.new(hash_mp(mp), DES3.MODE_CFB, iv)
# plaintext= staruct.pack("%sI" % len(vault_code), *vault_code)
c = des3.encrypt(vault_code)
return c | cwe | CWE-327 | Python |
public void close() {
Opus.INSTANCE.opus_encoder_destroy(opusEncoder);
} | vuln | Vulnerable | Java |
static decContext* tsd_dec_ctx_get(pthread_key_t *key) {
#ifndef WIN32
pthread_once(&dec_ctx_once, jv_tsd_dec_ctx_init); // cannot fail
#endif
decContext *ctx = (decContext*)pthread_getspecific(*key);
if (ctx) {
return ctx;
}
ctx = malloc(sizeof(decContext));
if (ctx) {
if (key == &dec_ctx_key)
... | vuln | Safe | C/C++ |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 3);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* start;
TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kStartTensor, &start));
const TfLiteTensor* limit;
TF_LITE_ENSU... | vuln | Safe | C/C++ |
/*
* Copyright (C) 2011, 2012, 2013 Citrix Systems
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, thi... | cwe | CWE-682 | C/C++ |
# Natural Language Toolkit: Transformation-based learning
#
# Copyright (C) 2001-2021 NLTK Project
# Author: Marcus Uneson <marcus.uneson@gmail.com>
# based on previous (nltk2) version by
# Christopher Maloof, Edward Loper, Steven Bird
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
impo... | cwe | CWE-1333 | Python |
WRITE_JSON_ELEMENT(ObjStart) {
/* increase depth, save: before first key-value no comma needed. */
ctx->depth++;
ctx->commaNeeded[ctx->depth] = false;
return writeChar(ctx, '{');
} | cwe | CWE-703 | Unknown |
# (c) 2013-2014, Michael DeHaan <michael.dehaan@gmail.com>
# Stephen Fromm <sfromm@gmail.com>
# Brian Coca <briancoca+dev@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publish... | vuln | Safe | Python |
juniper_mlppp_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, register const u_char *p)
{
struct juniper_l2info_t l2info;
l2info.pictype = DLT_JUNIPER_MLPPP;
if (juniper_parse_header(ndo, p, h, &l2info) == 0)
return l2info.header_len;
/* supp... | vuln | Safe | C/C++ |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);
OpContext op_context(context, node);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), op_context.params->num_splits);
auto input_type = op_context.input->type;
TF_LITE_ENSURE(context,
... | vuln | Vulnerable | C/C++ |
ParseNameValue(const char * buffer, int bufsize,
struct NameValueParserData * data)
{
struct xmlparser parser;
data->l_head = NULL;
data->portListing = NULL;
data->portListingLength = 0;
/* init xmlparser object */
parser.xmlstart = buffer;
parser.xmlsize = bufsize;
parser.data = data;
par... | cwe | CWE-119 | C/C++ |
static ssize_t smtcfb_read(struct fb_info *info, char __user *buf,
size_t count, loff_t *ppos)
{
unsigned long p = *ppos;
u32 *buffer, *dst;
u32 __iomem *src;
int c, i, cnt = 0, err = 0;
unsigned long total_size;
if (!info || !info->screen_base)
return -ENODEV;
if (info->state != FBINFO_STATE_RUNNING)... | cwe | CWE-787 | C/C++ |
/**
* oEmbed Plugin plugin
* Licensed under the MIT license
* jQuery Embed Plugin: http://code.google.com/p/jquery-oembed/ (MIT License)
* Plugin for: http://ckeditor.com/license (GPL/LGPL/MPL: http://ckeditor.com/license)
*/
(function() {
CKEDITOR.plugins.add('oembed',
{
icons: 'o... | cwe | CWE-19 | JavaScript |
def run_check(self, *args, **kwargs):
target_status = self.get_target_status(kwargs)
method = self.get_service_method(*args, **kwargs)
# Get a list of all services to be looking for
filtered_services = kwargs.get('service', [])
if not isinstance(filtered_services, list):
... | vuln | Safe | Python |
pvscsi_convert_sglist(PVSCSIRequest *r)
{
int chunk_size;
uint64_t data_length = r->req.dataLen;
PVSCSISGState sg = r->sg;
while (data_length) {
while (!sg.resid) {
pvscsi_get_next_sg_elem(&sg);
trace_pvscsi_convert_sglist(r->req.context, r->sg.dataAddr,
... | vuln | Vulnerable | C/C++ |
bool SharedMemory::Create(const SharedMemoryCreateOptions& options) {
DCHECK_EQ(-1, mapped_file_);
if (options.size == 0) return false;
if (options.size > static_cast<size_t>(std::numeric_limits<int>::max()))
return false;
base::ThreadRestrictions::ScopedAllowIO allow_io;
FILE *fp;
bool fix_size = tr... | cwe | CWE-264 | C/C++ |
def try_compile_and_link(compiler, source='', flags=[], verbose=False):
ensure_tmp_dir_exists()
with tempfile.NamedTemporaryFile() as sfile:
ofile = tempfile.mktemp()
try:
sfile.file.write(bytes(source, 'utf-8'))
sfile.file.flush()
ret = subprocess.run([compil... | cwe | CWE-377 | Python |
bool WebMediaPlayerImpl::HasSingleSecurityOrigin() const {
if (data_source_)
return data_source_->HasSingleOrigin();
return true;
} | cwe | CWE-346 | C/C++ |
<div class='graphWrapper' style='width:100%;' id='wrapper_<?php print $graph['local_graph_id']?>' graph_width='<?php print $graph['width'];?>' graph_height='<?php print $graph['height'];?>' title_font_size='<?php print ((read_user_setting('custom_fonts') == 'on') ? read_user_setting('title_size') : read_config_option('... | cwe | CWE-79 | PHP |
find(id, callback) {
pg.connect(this.connectionUri, function (err, client, done) {
if (err) {
return console.error('Could not connect to postgres', err);
done(client);
}
client.query('select id, term, tags, definition from terms where id = $1;... | vuln | Vulnerable | JavaScript |
package com.salesmanager.shop.admin.model.orders;
import com.salesmanager.core.model.common.Billing;
import com.salesmanager.core.model.common.Delivery;
import com.salesmanager.core.model.order.orderstatus.OrderStatus;
import javax.persistence.Embedded;
import java.io.Serializable;
import java.util.Arrays;
import jav... | cwe | CWE-79 | Java |
private static File extractFile (String sourcePath, File outFile) {
try {
if (!outFile.getParentFile().exists() && !outFile.getParentFile().mkdirs()) throw new GdxRuntimeException(
"Couldn't create ANGLE native library output directory " + outFile.getParentFile().getAbsolutePath());
OutputStream out = null;... | vuln | Safe | Java |
parse_bracket_exp (void)
{
int invert;
int c, c1, c2;
charclass ccl;
/* Used to warn about [:space:].
Bit 0 = first character is a colon.
Bit 1 = last character is a colon.
Bit 2 = includes any other character but a colon.
Bit 3 = includes ranges, char/equiv classes or collation elements. ... | cwe | CWE-189 | Unknown |
document.createElement("div");pa.className="geTempDlgNewDiagramCatItemLbl";pa.innerHTML=qa;ma.appendChild(pa);Ca.appendChild(ma);mxEvent.addListener(ma,"click",function(){function Ka(){var Ra=Ia.querySelector(".geTemplateDrawioCatLink");null!=Ra?Ra.click():setTimeout(Ka,200)}Z=!0;var Ia=M.querySelector(".geTemplatesLis... | cwe | CWE-20 | JavaScript |
do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
char *fname, int flen, struct iattr *iap,
struct svc_fh *resfhp, int createmode, u32 *verifier,
bool *truncp, bool *created)
{
struct dentry *dentry, *dchild = NULL;
struct inode *dirp;
__be32 err;
int host_err;
__u32 v_mtime=0, v_atime=0;
... | cwe | CWE-732 | Unknown |
ssize_t oe_recvfrom(
int sockfd,
void* buf,
size_t len,
int flags,
const struct oe_sockaddr* src_addr,
oe_socklen_t* addrlen)
{
ssize_t ret = -1;
oe_fd_t* sock;
if (!(sock = oe_fdtable_get(sockfd, OE_FD_TYPE_SOCKET)))
OE_RAISE_ERRNO(oe_errno);
ret = sock->ops.socket.rec... | cwe | CWE-200 | Unknown |
unsigned int get_random_int(void)
{
struct keydata *keyptr;
__u32 *hash = get_cpu_var(get_random_int_hash);
int ret;
keyptr = get_keyptr();
hash[0] += current->pid + jiffies + get_cycles();
ret = half_md4_transform(hash, keyptr->secret);
put_cpu_var(get_random_int_hash);
return ret;
} | cwe | CWE-703 | Unknown |
/*
* This file is part of Espruino, a JavaScript interpreter for Microcontrollers
*
* Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http... | vuln | Safe | C/C++ |
xfs_attr_node_addname(xfs_da_args_t *args)
{
xfs_da_state_t *state;
xfs_da_state_blk_t *blk;
xfs_inode_t *dp;
xfs_mount_t *mp;
int committed, retval, error;
trace_xfs_attr_node_addname(args);
/*
* Fill in bucket of arguments/results/context to carry around.
*/
dp = args->dp;
mp = dp->i_mount;
restart:
s... | cwe | CWE-19 | C/C++ |
static uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1,
uint64_t prp2, uint32_t len, NvmeCtrl *n)
{
hwaddr trans_len = n->page_size - (prp1 % n->page_size);
trans_len = MIN(len, trans_len);
int num_prps = (len >> n->page_bits) + 1;
if (unlikely(!prp1)... | vuln | Safe | C/C++ |
int Effect_command(effect_handle_t self,
uint32_t cmdCode,
uint32_t cmdSize,
void *pCmdData,
uint32_t *replySize,
void *pReplyData){
EffectContext * pContext = (EffectContext *) self;
int retsize;
if(pContext->EffectType == LVM_BASS_BOOST){
}
if(pContext->EffectType == LVM_VIRTUALIZER... | cwe | CWE-119 | C/C++ |
self::assertSame(!$isCrossOrigin, $request->hasHeader('Authorization'));
self::assertSame(!$isCrossOrigin, $request->hasHeader('Cookie'));
return new Response(200);
}
]); | vuln | Safe | PHP |
public void update(DatabaseTypeUpdateRequest request) {
databaseTypeDao.selectOptionalById(request.getId()).ifPresent(data -> {
if (DatabaseTypes.has(data.getDatabaseType())) {
throw DomainErrors.MUST_NOT_MODIFY_SYSTEM_DEFAULT_DATABASE_TYPE.exception();
}
Dat... | cwe | CWE-20 | Java |
http.ServerResponse.prototype.safeRedirect = function (url) {
const fullURL = new URL(url, config.urlPrefix);
if (!fullURL.toString().startsWith(config.urlPrefix)) return this.forbidden();
this.redirect(url);
}; | cwe | CWE-601 | JavaScript |
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2021 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except... | cwe | CWE-918 | C/C++ |
@Bean
@Override
public UserDetailsService userDetailsService() {
return username -> {
if (username.equals(callbackServiceConfig.getCertCn())) {
return new User(username, "", emptyList());
}
String exceptionMsg =
"The client certificate CN '"
+ username
... | vuln | Safe | Java |
mp_join_print(netdissect_options *ndo,
const u_char *opt, u_int opt_len, u_char flags)
{
const struct mp_join *mpj = (const struct mp_join *) opt;
if (!(opt_len == 12 && flags & TH_SYN) &&
!(opt_len == 16 && (flags & (TH_SYN | TH_ACK)) == (TH_SYN | TH_ACK)) &&
!(op... | cwe | CWE-787 | Unknown |
@Override
protected XrootdResponse<RmDirRequest> doOnRmDir(ChannelHandlerContext ctx, RmDirRequest req)
throws XrootdException
{
if (req.getPath().isEmpty()) {
throw new XrootdException(kXR_ArgMissing, "no path specified");
}
_log.info("Trying to delete directory {}"... | vuln | Vulnerable | Java |
Jsi_Value *Jsi_ValueArrayIndex(Jsi_Interp *interp, Jsi_Value *args, int index)
{
Jsi_Obj *obj = args->d.obj;
Jsi_Value *v;
assert(args->vt == JSI_VT_OBJECT);
if (obj->isarrlist && obj->arr)
return ((index < 0 || (uint)index >= obj->arrCnt) ? NULL : obj->arr[index]);
char unibuf[100];
Jsi... | cwe | CWE-120 | C/C++ |
/**
* plugin for displaying ROIs over an image canvas *
* Requires Raphael http://raphaeljs.com/
* and scale.raphael.js http://shapevent.com/scaleraphael/
*/
$.fn.roi_display = function(options) {
return this.each(function(){
var self = this;
var viewerId = this.id;
var $viewport... | cwe | CWE-116 | Python |
/* Keyring handling
*
* Copyright (C) 2004-2005, 2008, 2013 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Found... | cwe | CWE-255 | C/C++ |
static int xen_evtchn_cpu_prepare(unsigned int cpu)
{
int ret = 0;
if (evtchn_ops->percpu_init)
ret = evtchn_ops->percpu_init(cpu);
return ret;
} | vuln | Vulnerable | Unknown |
static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_codecid) {
AVCodecContext *vcodec = vstream->codec;
switch(flv_codecid) {
case FLV_CODECID_H263 : vcodec->codec_id = CODEC_ID_FLV1 ; break;
case FLV_CODECID_REALH263: vcodec->codec_id = CODEC_ID_H263 ; break;
... | vuln | Vulnerable | C/C++ |
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* th... | vuln | Safe | Java |
int snd_usbmidi_create(struct snd_card *card,
struct usb_interface *iface,
struct list_head *midi_list,
const struct snd_usb_audio_quirk *quirk)
{
struct snd_usb_midi *umidi;
struct snd_usb_midi_endpoint_info endpoints[MIDI_MAX_ENDPOINTS];
int out_ports, in_ports;
int i, err;
umidi = kz... | cwe | CWE-703 | C/C++ |
static int get_cluster_table(BlockDriverState *bs, uint64_t offset,
uint64_t **new_l2_table,
int *new_l2_index)
{
BDRVQcowState *s = bs->opaque;
unsigned int l1_index, l2_index;
uint64_t l2_offset;
uint64_t *l2_table = NULL;
int ret;
... | vuln | Vulnerable | C/C++ |
/* radare2 - LGPL - Copyright 2009-2020 - pancake */
#include <r_core.h>
#include <r_socket.h>
#include <config.h>
#include <r_util.h>
#if __UNIX__
#include <signal.h>
#endif
#define DB core->sdb
R_LIB_VERSION(r_core);
static ut64 letter_divs[R_CORE_ASMQJMPS_LEN_LETTERS - 1] = {
R_CORE_ASMQJMPS_LETTERS * R_CORE_AS... | vuln | Vulnerable | C/C++ |
filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully)
{
filepos_t Result;
FirstFrameLocation = input.getFilePointer(); // will be updated accordingly below
SetValueIsSet(false);
try {
if (ReadFully == SCOPE_ALL_DATA) {
Result = EbmlBinary::ReadData(input, ReadFully);
i... | vuln | Vulnerable | C/C++ |
DIR *dd_init_next_file(struct dump_dir *dd)
{
// if (!dd->locked)
// error_msg_and_die("dump_dir is not opened"); /* bug */
if (dd->next_dir)
closedir(dd->next_dir);
dd->next_dir = opendir(dd->dd_dirname);
if (!dd->next_dir)
{
error_msg("Can't open directory '%s'", dd->dd_dir... | cwe | CWE-20 | Unknown |
void TightDecoder::decodeRect(const Rect& r, const void* buffer,
size_t buflen, const ServerParams& server,
ModifiablePixelBuffer* pb)
{
const rdr::U8* bufptr;
const PixelFormat& pf = server.pf();
rdr::U8 comp_ctl;
bufptr = (const rdr::U8*)buffer;
... | vuln | Vulnerable | C/C++ |
/*
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator p... | cwe | CWE-732 | Java |
private void addJob(Job job) {
try {
JobWrapper jobWrapper = new JobWrapper(agentManager, job);
this.runningPool.execute(jobWrapper);
JobWrapper jobWrapperRet = jobs.putIfAbsent(jobWrapper.getJob().getJobInstanceId(), jobWrapper);
if (jobWrapperRet != null) {
... | vuln | Vulnerable | Java |
package identify
import (
"time"
"github.com/libp2p/go-libp2p-core/event"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/protocol"
pb "github.com/libp2p/go-libp2p/p2p/protocol/identify/pb"
"github.com/libp2p/go-msgio/protoio"
)
const IDDe... | vuln | Safe | Go |
private void sortMarkers(List<MapMarker> markers,
boolean visited,
@MapMarkersSortByDef int sortByMode,
@Nullable LatLon location) {
AndroidUtils.sortCopyOnWriteList(markers, new Comparator<MapMarker>() {
@Override
public int compare(... | vuln | Safe | Java |
void Compute(OpKernelContext* ctx) override {
const Tensor& handle = ctx->input(0);
const string& name = handle.scalar<tstring>()();
auto session_state = ctx->session_state();
OP_REQUIRES(ctx, session_state != nullptr,
errors::FailedPrecondition(
"DeleteSessionTensor ... | cwe | CWE-703 | C/C++ |
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* th... | cwe | CWE-79 | Java |
mount_args_check(int argc, char **argv, const char *action)
{
Eina_Bool opts = EINA_FALSE;
const char *node;
char buf[PATH_MAX];
struct stat st;
if (!strcmp(action, "mount"))
{
/* will ALWAYS be:
/path/to/mount -o nosuid,uid=XYZ,[utf8,] UUID=XXXX-XXXX[-XXXX-XXXX] /media/$devnode
... | vuln | Safe | Unknown |
public function delete($fileName = null)
{
$this->validateFileName();
list($name, $extension) = $this->model->getFileNameParts();
return $this->datasource->delete(
$this->model->getObjectTypeDirName(),
$name,
$extension
);
} | cwe | CWE-863 | PHP |
static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p,
int chunk_size, RTMPPacket **prev_pkt_ptr,
int *nb_prev_pkt, uint8_t hdr)
{
uint8_t buf[16];
int channel_id, timestamp, size;
uint32_t ts_field; // non-extended ti... | vuln | Safe | C/C++ |
el: $("#patientModelContainer")
});
// tell the model view where it's template is located
this.modelView.templateEl = $("#patientModelTemplate");
this.modelView.on('rendered', function () { // model rendered
$(function () {
$('.jquery-date-picker').datetimep... | vuln | Vulnerable | JavaScript |
package oci
import (
"bytes"
"fmt"
"io"
"os"
"path/filepath"
"strings"
"sync"
"syscall"
"time"
"github.com/cri-o/cri-o/pkg/config"
rspec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
"golang.org/x/net/context"
types "k8s.io/cri-api/pkg/apis/runtime/v1"
"k8s.io/client-go/too... | vuln | Safe | Go |
// mkerrors.sh -m32
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build 386,darwin
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m32 _const.go
package unix
import "syscall"
const (
AF_APPLETALK = 0x10
AF_CCITT = 0xa
... | cwe | CWE-287 | Go |
package controller
import (
"github.com/answerdev/answer/internal/base/handler"
"github.com/answerdev/answer/internal/base/middleware"
"github.com/answerdev/answer/internal/base/reason"
"github.com/answerdev/answer/internal/base/translator"
"github.com/answerdev/answer/internal/base/validator"
"github.com/answer... | cwe | CWE-284 | Go |
CAMLprim value caml_bitvect_test(value bv, value n)
{
int pos = Int_val(n);
return Val_int(Byte_u(bv, pos >> 3) & (1 << (pos & 7)));
} | cwe | CWE-119 | C/C++ |
void PluginInstance::DidReceiveManualResponse(const GURL& url,
const std::string& mime_type,
const std::string& headers,
uint32 expected_length,
... | vuln | Safe | C/C++ |
static inline int l2cap_config_rsp(struct l2cap_conn *conn,
struct l2cap_cmd_hdr *cmd, u16 cmd_len,
u8 *data)
{
struct l2cap_conf_rsp *rsp = (struct l2cap_conf_rsp *)data;
u16 scid, flags, result;
struct l2cap_chan *chan;
int len = cmd_len - sizeof(*rsp);
int err = 0;
if (cmd_len < sizeof(*rsp))
... | vuln | Safe | Unknown |
Win32StackFrameUnwinder::~Win32StackFrameUnwinder() { | vuln | Safe | C/C++ |
int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
{
bool pr = false;
u32 msr = msr_info->index;
u64 data = msr_info->data;
switch (msr) {
case MSR_AMD64_NB_CFG:
case MSR_IA32_UCODE_REV:
case MSR_IA32_UCODE_WRITE:
case MSR_VM_HSAVE_PA:
case MSR_AMD64_PATCH_LOADER:
case MSR_AMD64_BU_CFG2... | vuln | Vulnerable | C/C++ |
init_pci(struct vmctx *ctx)
{
struct mem_range mr;
struct pci_vdev_ops *ops;
struct businfo *bi;
struct slotinfo *si;
struct funcinfo *fi;
size_t lowmem;
int bus, slot, func;
int success_cnt = 0;
int error;
pci_emul_iobase = PCI_EMUL_IOBASE;
pci_emul_membase32 = vm_get_lowmem_limit(ctx);
pci_emul_membase64... | cwe | CWE-617 | C/C++ |
#ifdef HAVE_LIBWEBP
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "gd.h"
#include "gdhelpers.h"
#include "webp/decode.h"
#include "webp/encode.h"
#define GD_WEBP_ALLOC_STEP (4*1024)
gdImagePtr gdImageCreateFromWebp (FILE * inFile)
{
gdImagePtr im;
gdIOCtx *in = gdNewFileCtx(i... | cwe | CWE-190 | C/C++ |
// SPDX-License-Identifier: GPL-3.0-or-later
#include "../libnetdata.h"
// ----------------------------------------------------------------------------
// URL encode / decode
// code from: http://www.geekhideout.com/urlcode.shtml
/* Converts a hex character to its integer value */
char from_hex(char ch) {
return... | cwe | CWE-200 | C/C++ |
"120px",k.style.backgroundImage="url('"+IMAGE_PATH+"/droptarget.png')",k.style.backgroundPosition="center 65%",k.style.backgroundRepeat="no-repeat",D=document.createElement("div"),D.style.position="absolute",D.style.width="420px",D.style.top="58%",D.style.textAlign="center",D.style.fontSize="18px",D.style.color="#a0c3f... | vuln | Vulnerable | JavaScript |
getprivs_ret * get_privs_2_svc(krb5_ui_4 *arg, struct svc_req *rqstp)
{
static getprivs_ret ret;
gss_buffer_desc client_name, service_name;
OM_uint32 minor_stat;
kadm5_server_handle_t handle;
const char *errmsg = NULL;
... | cwe | CWE-772 | C/C++ |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | vuln | Safe | C/C++ |
static u32 __peek_user_compat(struct task_struct *child, addr_t addr)
{
struct user32 *dummy32 = NULL;
per_struct32 *dummy_per32 = NULL;
addr_t offset;
__u32 tmp;
if (addr < (addr_t) &dummy32->regs.acrs) {
/*
* psw and gprs are stored on the stack
*/
if (addr == (addr_t) &dummy32->regs.psw.mask) {
/*... | cwe | CWE-399 | Unknown |
package service
import (
"context"
"fmt"
"net"
"net/netip"
"strings"
"time"
"github.com/go-errors/errors"
grpc_auth "github.com/grpc-ecosystem/go-grpc-middleware/auth"
"github.com/openfga/openfga/pkg/encoder"
"github.com/openfga/openfga/pkg/encrypter"
"github.com/openfga/openfga/pkg/logger"
"github.com/op... | cwe | CWE-863 | Go |
Status BuildInputArgIndex(const OpDef::ArgDef& arg_def, AttrSlice attr_values,
const FunctionDef::ArgAttrs* arg_attrs,
bool ints_on_device,
int64_t resource_arg_unique_id) {
bool is_type_list;
DataTypeVector dtypes;
TF_RETUR... | vuln | Safe | Unknown |
copy: function (from, dist, callback) {
var that = this,
cmd = '';
dist = path.resolve(dist);
fs.lstat(from, function (err, stats) {
if (err) {
callback(err);
} else {
if (stats.isDirectory()) {
that.mkdir(dist, function (err) {
if (err) {
... | cwe | CWE-77 | JavaScript |
public int onDataRead(final ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding,
boolean endOfStream) throws Http2Exception {
Http2Stream stream = connection.stream(streamId);
Http2LocalFlowController flowController = flowController();
int... | vuln | Safe | Java |
bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov)
{
int i;
for (i = 0; i < qiov->niov; i++) {
if ((uintptr_t) qiov->iov[i].iov_base % bs->buffer_alignment) {
return false;
}
if (qiov->iov[i].iov_len % bs->buffer_alignment) {
return false;
... | vuln | Vulnerable | C/C++ |
/* Copyright 2016 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 |
static int dccp_setsockopt_change(struct sock *sk, int type,
struct dccp_so_feat __user *optval)
{
struct dccp_so_feat opt;
u8 *val;
int rc;
if (copy_from_user(&opt, optval, sizeof(opt)))
return -EFAULT;
val = kmalloc(opt.dccpsf_len, GFP_KERNEL);
if (!val)
return -ENOMEM;
if (copy_from_user(val, opt... | vuln | Vulnerable | Unknown |
static int vvfat_open(BlockDriverState *bs, const char* dirname, int flags)
{
BDRVVVFATState *s = bs->opaque;
int i;
#ifdef DEBUG
vvv = s;
#endif
DLOG(if (stderr == NULL) {
stderr = fopen("vvfat.log", "a");
setbuf(stderr, NULL);
})
s->bs = bs;
s->sectors_per_cluster=0x10;
s->current... | vuln | Safe | C/C++ |
private void setOptions() {
if (getContext() == null)
return;
boolean pro = ActivityBilling.isPro(getContext());
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
swNewestFirst.setChecked(prefs.getBoolean("notify_newest_first", false));
... | vuln | Vulnerable | Java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.