text stringlengths 79 3.72M |
|---|
<vulnerable_code>def test_server_proxy_websocket_subprotocols(event_loop):
event_loop.run_until_complete(_websocket_subprotocols())
<commit_title>[PATCH 1/2] validate proxied paths starting with /<commit_description>- restrict regex to `(/.*|)` to require starting with `/` or being empty string
- double-safe ensure... |
<vulnerable_code>from flask import request
from flask_jwt_extended import (
create_access_token,
create_refresh_token,
get_jwt_identity,
jwt_refresh_token_required,
)
from ..api import BaseApi, safe
from ..const import (
API_SECURITY_ACCESS_TOKEN_KEY,
API_SECURITY_PASSWORD_KEY,
API_SECURITY... |
<vulnerable_code>import json
import logging
import re
from typing import Dict, List, Optional, Set, Tuple
from flask import g, session, url_for
from flask_babel import lazy_gettext as _
# Role Mapping
app.config.setdefault("AUTH_ROLES_MAPPING", {})
app.config.setdefault("AUTH_ROLES_SYNC_AT_LOGI... |
<vulnerable_code><commit_title>[PATCH] chore: improve schema validation (#1712)<commit_description><fixed_code>
from typing import Union
from flask import current_app
from flask_appbuilder.const import (
API_SECURITY_PROVIDER_DB,
API_SECURITY_PROVIDER_LDAP,
AUTH_DB,
AUTH_LDAP,
)
from marshmallow import... |
<vulnerable_code> VirtIONet *n = qemu_get_nic_opaque(nc);
VirtIONetQueue *q = virtio_net_get_subqueue(nc);
VirtIODevice *vdev = VIRTIO_DEVICE(n);
struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE];
struct virtio_net_hdr_mrg_rxbuf mhdr;
unsigned mhdr_cnt = 0;
size_t offset, i, guest_offset;
if (!vi... |
<vulnerable_code>
@commands.command(name="ping")
async def rep(self, ctx: MyContext):
"""Get bot latency
You can also use this command to ping any other server"""
m = await ctx.send("Ping...")
t = (m.created_at - ctx.message.created_at).total_seconds()
try:<commit_title>[... |
<vulnerable_code> client_connection_t *old_cli = sqlc_client();
sqlc_set_client (NULL);
dbe_table_t * tb = sch_name_to_table (wi_inst.wi_schema, table);
dbe_key_t * key = tb ? tb_find_key (tb, index_name, NULL) : NULL;
if (!key)
{
caddr_t err = NULL;
}
}
void
ddl_add_col (query_instance_t * qi... |
<vulnerable_code> len = cl->cl_pos[rv];
if (CL_FIRST_VAR == len)
{
if (key->key_version != IE_KEY_VERSION (row))
key = key->key_versions[IE_KEY_VERSION (row)];
off = 0 == IE_KEY_VERSION (row) ? key->key_key_var_start[rv] : key->key_row_var_start[rv];
len = SHORT_REF (row + key->key_length_area... |
<vulnerable_code> if (encoded[1] & 0x80)
m_adpcmState[c].previousValue -= 0x10000;
m_adpcmState[c].index = encoded[2];
*decoded++ = m_adpcmState[c].previousValue;
predictor -= 0x10000;
state.previousValue = clamp(predictor, MIN_INT16, MAX_INT16);
state.index = encoded[1] & 0x7f;
encoded += 2;
fo... |
<vulnerable_code><commit_title>[PATCH 1/6] test: add a tets for GH-16<commit_description><fixed_code>
const TICK_COUNT = 3;
function evilFunction () {
global.evilFlag = true;
}
function makeIIFE (code) {
return `(${code})()`;
}
function waitTick () {
return new Promise(resolve => setTimeout(resolve));
} ... |
<vulnerable_code>var Replicator = require('../');
var assert = require('assert');
it('Should add and remove transforms', function () {
var replicator = new Replicator();
assert.strictEqual(actual.foo, 'bar');
assert.strictEqual(actual.ans, 42);
});
});<commit_title>[PATCH 1/6] test: add a t... |
<vulnerable_code> return savedEval('this');
})();
var ARRAY_BUFFER_SUPPORTED = typeof ArrayBuffer === 'function';
var MAP_SUPPORTED = typeof Map === 'function';
var SET_SUPPORTED = typeof Set === 'function';
var TYPED_ARRAY_CTORS = [
'Int8Array',
'Uint8Array',
'Uint8ClampedArray',
... |
<vulnerable_code>
var TYPED_ARRAY_SUPPORTED = function (typeName) {
return typeof TYPED_ARRAY_CTORS[typeName] === 'function';
}
// Saved proto functions
var arrSlice = Array.prototype.slice;<commit_title>[PATCH 1/6] test: add a tets for GH-16<commit_description><fixed_code>
var TYPED_ARRAY_SUPPORTED = function... |
<vulnerable_code> Float64Array
};
var ARRAY_BUFFER_SUPPORTED = typeof ArrayBuffer === 'function';
var MAP_SUPPORTED = typeof Map === 'function';
var SET_SUPPORTED = typeof Set === 'function';
var TYPED_ARRAY_SUPPORTED = function (typeName) {
return typeof TYPED_ARRAY_CTORS[typeName] === 'fun... |
<vulnerable_code>})();
var TYPED_ARRAY_CTORS = {
Int8Array,
Uint8Array,
Uint8ClampedArray,
Int16Array,
Uint16Array,
Int32Array,
Uint32Array,
Float32Array,
Float64Array
};
function isFunction (value) {<commit_title>[PATCH 1/6] test: add a tets for GH-16<commit_description><fixed_cod... |
<vulnerable_code>})();
var TYPED_ARRAY_CTORS = {
'Int8Array': Int8Array,
'Uint8Array': Uint8Array,
'Uint8ClampedArray': Uint8ClampedArray,
'Int16Array': Int16Array,
'Uint16Array': Uint16Array,
'Int32Array': Int32Array,
'Uint32Array': Uint32Array,
'Float32Array': Float32Array,
'Float... |
<vulnerable_code> int maxlen) attribute_hidden;
extern void __open_nameservers(void) attribute_hidden;
extern void __close_nameservers(void) attribute_hidden;
#define __encode_dotted(dotted,dest,maxlen) \
dn_comp((dotted), (dest), (maxlen), NULL, NULL)
bool ends_with_dot;
bool contains_dot;
sockaddr46_t sa;
fd ... |
<vulnerable_code> ALLOCD_BOOL(zck, comp);
ALLOCD_BOOL(zck, src);
comp->data = zrealloc(comp->data, comp->data_size + src_size);
if (!comp->data) {
zck_log(ZCK_LOG_ERROR, "OOM in %s", __func__);<commit_title>[PATCH] Handle overflow errors in malformed zchunk files<commit_description>Thanks to Ago... |
<vulnerable_code> ALLOCD_INT(zck, dst_size);
ALLOCD_INT(zck, comp);
comp->dc_data = zrealloc(comp->dc_data, comp->dc_data_size + src_size);
if (!comp->dc_data) {
zck_log(ZCK_LOG_ERROR, "OOM in %s", __func__);<commit_title>[PATCH] Handle overflow errors in malformed zchunk files<commit_descriptio... |
<vulnerable_code>
/* Add new data to stored buffer */
if(mp->buffer) {
buf = zrealloc(mp->buffer, mp->buffer_len + l);
if (!buf) {
zck_log(ZCK_LOG_ERROR, "OOM in %s", __func__);<commit_title>[PATCH] Handle overflow errors in malformed zchunk files<commit_description>Thanks to Agostin... |
<vulnerable_code>}
static bool read_header_from_file(zckCtx *zck) {
/* Verify that lead_size and header_length have been set */
if(zck->lead_size == 0 || zck->header_length == 0) {
set_error(zck, "Lead and header sizes are both 0. Have you run zck_read_lead() yet?");
return false;
}
/... |
<vulnerable_code>import json
import lxml.etree as etree
import pkg_resources
from copy import deepcopy
# Construct new resource
result = {}
for field in self.resource_content_fields:
result[field] = data[field]
resource_id = stem_url(data['url'])
self._check_redund... |
<vulnerable_code> * This function is triggered when clicking on the header of the resource list.
*/
function bindToggleResourceListEvent() {
if ($(this).hasClass('recommender_resourceListExpanded')) {
Logger.log('mit.recommender.hideShow', generateLog(loggerStatus['hideShow']['hide']));... |
<vulnerable_code>
setup(
name='recommender-xblock',
version='1.3',
description='recommender XBlock', # TODO: write a better description.
long_description=README,
author='edX',<commit_title>[PATCH] =?UTF-8?q?=E2=80=9CRecommender=E2=80=9D=20fix?=<commit_description><fixed_code>
setup(
name='rec... |
<vulnerable_code>
// TODO: Add check for namespace stuff
// append any selectors in childSeq's head
parentSeqClone->mutable_last()->head()->concat(base->head());
// Set parentSeqClone new tail
parentSeqClone->mutable_last()->tail( base->tail() );
... |
<vulnerable_code> quality = 80;
}
argb = (uint8_t *)gdMalloc(gdImageSX(im) * 4 * gdImageSY(im));
if (!argb) {
return;<commit_title>[PATCH] Fix integer overflow in gdImageWebpCtx<commit_description>Integer overflow can be happened in expression gdImageSX(im) * 4 *
gdImageSY(im). It could lead to heap buffer overf... |
<vulnerable_code> // but only do this, if the Popup is still visible
if (c == Ctrl_E)
{
ins_compl_delete();
if (compl_leader != NULL)
ins_bytes(compl_leader + get_compl_len());
else if (compl_first_match != NULL)
ins_bytes(compl_orig_text + get_compl_len());
retval = TRUE;
}
<commit_title>[... |
<vulnerable_code>
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
19,
/**/<commit_title>[PATCH] patch 9.0.0020: with some completion reading past end of<commit_description><fixed_code>
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
20,
/*... |
<vulnerable_code> char buf[256];
X509_NAME_oneline(X509_get_subject_name(err_cert), buf, 256);
SimpleRefHolder<QoreStringNode> ssl_err(new QoreStringNodeMaker("verify error %d depth %d: %s: %s", err,
depth, X509_verify_cert_error_string(err), buf));
// At this point... |
<vulnerable_code>static rfbBool
rfbSetClientColourMapBGR233(rfbClientPtr cl)
{
char buf[sz_rfbSetColourMapEntriesMsg + 256 * 3 * 2];
rfbSetColourMapEntriesMsg *scme = (rfbSetColourMapEntriesMsg *)buf;
uint16_t *rgb = (uint16_t *)(&buf[sz_rfbSetColourMapEntriesMsg]);
int i, len;
int r, g, b;
le... |
<vulnerable_code> this.dwf = datasetWrapperFactory;
this.webappDaoFactory = wadf;
if (skipInitialization) {
OntModel ontModel = ModelFactory.createOntologyModel(
OntModelSpec.OWL_MEM);<commit_title>[PATCH] Add sanitization to fix SPARQL injection vulnerability.<commit_descrip... |
<vulnerable_code>int ndpi_netbios_name_interpret(char *in, size_t in_len, char *out, u_int out_len) {
u_int ret = 0, len, idx = in_len, out_idx = 0;
len = (*in++)/2;
out_len--;
out[out_idx] = 0;
<commit_title>[PATCH] Added further checks<commit_description><fixed_code>
int ndpi_netbios_name_interpret(char *in,... |
<vulnerable_code> i += 4 + extension_len, offset += 4 + extension_len;
} /* for */
ja3_str_len = snprintf(ja3_str, sizeof(ja3_str), "%u,", ja3.server.tls_handshake_version);
for(i=0; i<ja3.server.num_cipher; i++) {
rc = snprintf(&ja3_str[ja3_str_len], sizeof(ja3_str)-ja3_str_len, "%s%u", (i > 0) ? ... |
<vulnerable_code> * @return a runnable for firing the deferred change event
*/
public Runnable deferredUpdateFromClient(String key, Serializable value) {
if (!mayUpdateFromClient(key, value)) {
if (isDisallowedByFilter(key)) {
return () -> {
// nop
... |
<vulnerable_code> }
private BeanModelType<?> getListItemBeanModelType(ListModelType<?> type) {
ComplexModelType<?> itemType = ((ListModelType<?>) type).getItemType();
if (itemType instanceof BeanModelType<?>) {
return (BeanModelType<?>) itemType;
} else if (itemType instanceo... |
<vulnerable_code>#include <time.h>
#include <stdlib.h>
#include <stdio.h>
/* ---------------------------------------------------------------------- */
{
if(REPORT_GROUP_CODES == 0)
{
verbprintf(3,"FLEX: Group messages seem to have been missed; Groupbit: %i; Clearing dat... |
<vulnerable_code> threading.Thread(target=warm_up_modules, name="warm-up", daemon=True).start()
auto_opentab_delay()
demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", server_port=PORT, auth=AUTHENTICATION, favicon_path="docs/logo.png")
# 如果需要在二级路径下运行
# CUSTOM_PATH, = ... |
<vulnerable_code>import cgi
import getpass
import hashlib
import httplib
import mimetypes
import os
import re
import shutil
import socket
import ssl
try:
from ssl import match_hostname
except ImportError:
from backports.ssl_match_hostname import match_hostname
import sys
import tempfile
from pip.backwardcompat ... |
<vulnerable_code> public Namespace(String prefix, String uri) {
this.prefix = (prefix != null) ? prefix : "";
this.uri = (uri != null) ? uri : "";
}
/**<commit_title>[PATCH] #48 Validate QName inputs - throw IllegalArgumentException<commit_description><fixed_code>
public Namespace(String... |
<vulnerable_code>import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import org.dom4j.tree.QNameCache;
import org.dom4j.util.SingletonStrategy;
* object is immutable.
*
* @author <a href="mailto:jstrachan@apache.org">James Strachan </a>
*/
public class QName implements... |
<vulnerable_code>
if (index < 0) {
return get(qualifiedName, Namespace.get(uri));
} else {
String name = qualifiedName.substring(index + 1);
String prefix = qualifiedName.substring(0, index);<commit_title>[PATCH] #48 Validate QName inputs - throw IllegalArgumentExcept... |
<vulnerable_code><commit_title>[PATCH] #48 Validate QName inputs - throw IllegalArgumentException<commit_description><fixed_code>
package org.dom4j;
import org.testng.annotations.Test;
/**
* @author Filip Jirsák
*/
public class AllowedCharsTest {
@Test
public void localName() {
QName.get("element");... |
<vulnerable_code>static int crypto_rsa_common(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus,
const BYTE* exponent, int exponent_size, BYTE* output)
{
BN_CTX* ctx;
int output_length = -1;
BYTE* input_reverse;
BYTE* modulus_reverse;
BYTE* exponent_reverse;
BIGNUM... |
<vulnerable_code> "sso_auth_bad_user.html",
],
template_dir,
)
# These templates have no placeholders, so render them here<commit_title>[PATCH] Enable autoescape for SSO templates.<commit_description><fixed_code>
"sso_auth_bad_user.html",
... |
<vulnerable_code> (void) ConcatenateString(&metadata,buffer);
}
if (metadata != (char *) NULL)
SetImageProperty(image,"vips:metadata",metadata);
(void) CloseBlob(image);
if (status == MagickFalse)
return((Image *) NULL);<commit_title>[PATCH] https://github.com/ImageMagick/ImageMagick/issues/770<com... |
<vulnerable_code>const getPort = require('./get-port')
const { userConfigId } = require('../common/constants')
const { initLang } = require('./locales')
exports.getConfig = async () => {
const userConfig = await dbAction('data', 'findOne', {
const config = {
...defaultSetting,
...userConfig,
port
}
... |
<vulnerable_code> {
LANG: `${sysLocale.replace(/-/, '_')}.UTF-8`,
electermPort: config.port,
electermHost: config.host
},
env
),<commit_title>[PATCH] fix #1686 [security] Add token verify for http request<commit_description><fixed_code>
{
LANG: `${sysLocale.rep... |
<vulnerable_code>const {
terminals
} = require('./remote-common')
app.use(cors())
require('express-ws')(app)
app.post('/terminals', async function (req, res) {
const { body } = req
const { isTest } = req.query
if (isTest) {
}
})
app.post('/terminals/:pid/size', function (req, res) {
const pid = req.par... |
<vulnerable_code>
const jsonHeader = {
Accept: 'application/json',
'Content-Type': 'application/json'
}
function parseResponse (response) {<commit_title>[PATCH] fix #1686 [security] Add token verify for http request<commit_description><fixed_code>
const jsonHeader = {
Accept: 'application/json',
'Content-Type... |
<vulnerable_code>export default (type, id, sessionId = '', sftpId = '') => {
// init gloabl ws
const { host, port } = window._config
const wsUrl = `ws://${host}:${port}/${type}/${id}?sessionId=${sessionId}&sftpId=${sftpId}`
const ws = new WebSocket(wsUrl)
ws.s = msg => {
ws.send(JSON.stringify(msg))<commi... |
<vulnerable_code> 'user.updateCover': socketUser.updateCover,
'groups.cover.update': socketGroup.cover.update,
};
if (!socket.uid || !data || !data.chunk || !data.params || !data.params.method || !methodToFunc[data.params.method]) {
throw new Error('[[error:invalid-data]]');
}
inProgress[socket.id] = inProgre... |
<vulnerable_code>static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w)
{
long i;
for (i = 0; i <= w - sizeof(long); i += sizeof(long)) {
long a = *(long *)(src1 + i);
long b = *(long *)(src2 + i);
*(long *)(dst + i) = ((a & pb_7f) + (b & pb_7f)) ^ ((a ^ b) & pb_80... |
<vulnerable_code>
case TLS_ASYNC_BUILD:
{
/* Signature algorithm. */
if ((args->idx - args->begin) + ENUM_LEN + ENUM_LEN > totalSz) {
ERROR_OUT(BUFFER_ERROR, exit_dcv);
/* Check for public key of required type. */
#ifdef HAVE_ED25519
... |
<vulnerable_code> (void) ResetMagickMemory(colormap_index,(-1),MaxColormapSize*
sizeof(*colormap_index));
if (AcquireImageColormap(image,MaxColormapSize,exception) == MagickFalse)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
image->colors... |
<vulnerable_code> y;
unsigned char
*lastrow,
*one_row,
*ptr;
2*image->columns),sizeof(*one_row));
if (one_row == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
lastrow=(unsigned char *) NULL;
if (compressionType == PALM_COMPRESSION_S... |
<vulnerable_code> break;
case PTR_TO_STACK:
pointer_desc = "stack ";
break;
default:
break;<commit_title>[PATCH] bpf: force strict alignment checks for stack pointers<commit_description>Force strict alignment checks for stack pointers because the tracking of
stack spills relies on it; unaligned stack accesses ... |
<vulnerable_code> goto return_i;
break;
case CRED_DOM:
if (parsed_info->verboseflag)
fprintf(stderr, "domain=%s\n",
temp_val);
strlcpy(parsed_info->domain, temp_val,
sizeof(parsed_info->domain));
break;
case CRED_UNPARSEABLE:
if (parsed_info->verboseflag)
fprintf(stderr, "Credenti... |
<vulnerable_code> path[path.length - 1] = $tmp[0];
}
$baseKey = self.quoteIdentifier(key)+'#>>\'{'+path.join(', ')+'}\'';
if (options.prefix) {
if (options.prefix instanceof Utils.literal) {<commit_title>[PATCH] fix(postgres): json path key quoting (#11088)<commit_... |
<vulnerable_code>void ntlm_generate_exported_session_key(NTLM_CONTEXT* context)
{
WINPR_ASSERT(context);
WINPR_ASSERT(sizeof(context->ExportedSessionKey) == sizeof(context->RandomSessionKey));
CopyMemory(context->ExportedSessionKey, context->RandomSessionKey,
sizeof(context->ExportedSessionKey));<commit... |
<vulnerable_code>from tlsfuzzer.utils.lists import natural_sort_keys
from tlsfuzzer.utils.ordered_dict import OrderedDict
version = 5
def help_msg():
conversations["too short PKCS padding"] = conversation
# check if too long PKCS padding is detected
conversation = Connect(host, port)
node = convers... |
<vulnerable_code>
@api.route('/user/<int:user_id>/')
def user_detail(user_id):
user = User.query.get_or_404(user_id)
# Set up divisions
submit = map(lambda p: p.division,
@api.route('/group/<int:group_id>/')
def group_detail(group_id):
group = Group.query.get_or_404(group_id)
submit = map(lambda ... |
<vulnerable_code> s.add("com.mchange.v2.c3p0.JndiRefForwardingDataSource");
s.add("com.mchange.v2.c3p0.WrapperConnectionPoolDataSource");
DEFAULT_NO_DESER_CLASS_NAMES = Collections.unmodifiableSet(s);
}
<commit_title>[PATCH] Fix #2097 for 2.6.7.2<commit_description><fixed_code>
s.add... |
<vulnerable_code> }
}
if (_metadataKey.isEmpty()) {
qCDebug(lcCse()) << "Migrating from v1.1 to v1.2";
if (metadataKeys.isEmpty()) {
qCDebug(lcCse()) << "Could not migrate. No metadata keys found!";
}
}
const auto sharing = metadataObj["sharing"].toString().... |
<vulnerable_code> GList *temp = remote_sdp->attributes;
while(temp) {
janus_sdp_attribute *a = (janus_sdp_attribute *)temp->data;
if(a && a->name) {
if(!strcasecmp(a->name, "fingerprint")) {
JANUS_LOG(LOG_VERB, "[%"SCNu64"] Fingerprint (global) : %s\n", handle->handle_id, a->value);
if(strcasestr(a->val... |
<vulnerable_code> self.subscriber = self.create_user('subscriber')
self.non_subscriber = self.create_user('non-subscriber')
self.non_subscriber_2 = self.create_user('non-subscriber-2')
PageSubscription.objects.create(
page=self.child_page,
comment_notifications=Tr... |
<vulnerable_code> # Get subscribers to individual threads
replies = CommentReply.objects.filter(comment_id__in=relevant_comment_ids)
comments = Comment.objects.filter(id__in=relevant_comment_ids)
thread_users = get_user_model().objects.exclude(pk=self.request.user.pk).exclude(pk__in=subsc... |
<vulnerable_code>#!/usr/bin/env python3
# License: GPLv3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
from base64 import standard_b64decode
from collections import OrderedDict
from itertools import count
from typing import Dict, Optional, Callable
from .constants import is_macos, logo_png_file
from .fast_da... |
<vulnerable_code> update_window_title, update_window_visibility, wakeup_main_loop
)
from .keys import keyboard_mode_name, mod_mask
from .notify import NotificationCommand, handle_notification_cmd
from .options.types import Options
from .rgb import to_color
from .terminfo import get_capabilities
self.screen.s... |
<vulnerable_code> self.assertEqual(hash(SingleKey(key=1)), hash(SingleKey(key=1)))
self.assertNotEqual(hash(SingleKey(key=1, mods=2)), hash(SingleKey(key=1)))
self.assertNotEqual(SingleKey(key=1, mods=2), SingleKey(key=1))<commit_title>[PATCH] Sanitize notifications ids as they are retransmitted ... |
<vulnerable_code>from flask.wrappers import Response
from flask_babel import Babel # type: ignore
from flask_babel import get_translations
from werkzeug.utils import secure_filename
from fava import __version__ as fava_version
"_layout.html",
active_page="help",
page_slug=page_slug,
he... |
<vulnerable_code>from beancount.core.flags import FLAG_SUMMARIZE
from beancount.core.flags import FLAG_TRANSFER
from beancount.parser.printer import format_entry # type: ignore
from fava.core._compat import FLAG_RETURNS
from fava.core._compat import FLAG_UNREALIZED
)
self.ledger.extens... |
<vulnerable_code>from typing import MutableMapping
from typing import TypeVar
import flask
from beancount.core import compare
from beancount.core import realization
from beancount.core.account import ACCOUNT_RE
from beancount.core.inventory import Inventory
from beancount.core.number import Decimal
from beancount.core... |
<vulnerable_code> return currentUserSubject.value;
},
signInViaOAuth,
};
function login(email, password) {
});
}
function logout() {
// remove user from local storage to log user out
localStorage.removeItem('currentUser');<commit_title>[PATCH] Feature: Add data transfer object layer to validate and<com... |
<vulnerable_code>}
function updateCurrentUser(firstName, lastName) {
const body = { firstName, lastName };
const requestOptions = { method: 'PATCH', headers: authHeader(), body: JSON.stringify(body) };
return fetch(`${config.apiUrl}/users/update`, requestOptions).then(handleResponse);
}<commit_title>[PATCH] Feat... |
<vulnerable_code>
def from_value(value):
"""Convert a value to be stored in redis"""
if isinstance(value, basestring):
# Keep most readability, do not pickle string values
return value
try:
return pickle.dumps(value)
except Exception:
return value
def to_value(pickled):... |
<vulnerable_code>
desired_fee_rate = 1.0 # sats/B, just init this value for paranoia
try:
tx = self.main_window.wallet.make_unsigned_transaction(coins, outputs, self.main_window.config, fee, None)
desired_fee_rate = tx.get_fee() / tx.estimated_size() # remember the fee coin cho... |
<vulnerable_code> if (HeapOverflowSanityCheck(rows,sizeof(*tile_pixels)) != MagickFalse)
ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed");
extent=MagickMax(rows*TIFFTileRowSize(tiff),TIFFTileSize(tiff));
tile_pixels=(unsigned char *) AcquireQuantumMemory(extent,
... |
<vulnerable_code> * - http://www.gnu.org/copyleft/gpl.html
*
* Author: Mark J Panaghiston
* Version: 2.2.19
* Date: 29th January 2013
*/
/* Code verified using http://www.jshint.com/ */
$.jPlayer.prototype = {
count: 0, // Static Variable: Change it via prototype.
version: { // Static Object
script: "2.2... |
<vulnerable_code>}
static void parse_alphanumeric(struct Flex * flex, unsigned int * phaseptr, char PhaseNo, unsigned int mw1, unsigned int len, int cont, int frag, int flex_groupmessage, int flex_groupbit) {
if (flex==NULL) return;
verbprintf(3, "FLEX: Parse Alpha Numeric %u %u\n", mw1, len);
<commit... |
<vulnerable_code> into records)
- Create or update associated (published) record with data
"""
self.require_permission(identity, "publish")
# Get the draft
draft = self.draft_cls.pid.resolve(id_, registered_only=False)
# Validate the draft strictly - si... |
<vulnerable_code>from contextlib import suppress
from copy import copy
from queue import SimpleQueue
from typing import TYPE_CHECKING
from sqlalchemy import func, select
from airflow.jobs.job import perform_heartbeat
from airflow.models.trigger import Trigger
from airflow.stats import Stats
from airflow.triggers.base... |
<vulnerable_code> @internal_api_call
def from_object(cls, trigger: BaseTrigger) -> Trigger:
"""Alternative constructor that creates a trigger row based directly off of a Trigger object."""
classpath, kwargs = trigger.serialize()
return cls(classpath=classpath, kwargs=kwargs)
@classme... |
<vulnerable_code>from __future__ import annotations
import datetime
import pytest
import pytz
from airflow.jobs.job import Job
from airflow.jobs.triggerer_job_runner import TriggererJobRunner
from airflow.models import TaskInstance, Trigger
from airflow.operators.empty import EmptyOperator
from airflow.triggers.base... |
<vulnerable_code> def run(self, command: str) -> str:
"""Run command with own globals/locals and returns anything printed."""
try:
print(self.globals)
result = self.wasm.exec(command, globals=self.globals, locals=self.locals)
output = result.text
except Exc... |
<vulnerable_code> percentage += percentage_per_page
text = f"Converting page {page}/{n_pages} to pixels"
self.print_progress(document, False, text, percentage)
# TODO handle leftover code input
text = "Converted document to pixels"
self.print_prog... |
<vulnerable_code> commonmark: require('./presets/commonmark')
};
var BAD_PROTOCOLS = [ 'vbscript', 'javascript', 'file' ];
function validateLink(url) {
// url should be normalized at this point, and existing entities are decoded
//
var str = url.trim().toLowerCase();
if (str.indexOf(':') >= 0 && BAD_PRO... |
<vulnerable_code> original_parsed = urlparse(response.request.url)
redirect_parsed = urlparse(url)
if (original_parsed.hostname != redirect_parsed.hostname):
del headers['Authorization']
# .netrc might have more auth for us on our new host.<commit_title>[PATC... |
<vulnerable_code> auth=('user', 'pass'),
)
assert r.history[0].request.headers['Authorization']
assert not r.request.headers.get('Authorization', '')
def test_auth_is_retained_for_redirect_on_host(self, httpbin):
r = requests.get(httpbin('redirect/1'), auth=('user', 'pass... |
<vulnerable_code> parser_raise_error (context_p, PARSER_ERR_COLON_EXPECTED);
}
if (context_p->token.type != LEXER_RIGHT_BRACE
&& context_p->token.type != LEXER_ASSIGN
&& context_p->token.type != LEXER_COMMA)
{
parser_raise_error (context_p, PARSER_ERR_OBJECT_ITEM_SE... |
<vulnerable_code> this.scale = scale;
}
private String clean(String svg) {
svg = svg.toLowerCase().replaceAll("\\s", "");
if (svg.contains("<script>"))
return EMPTY_SVG;
if (svg.contains("</script>"))
return EMPTY_SVG;
if (svg.contains("<foreignobject"))
return EMPTY_SVG;
if (svg.contains("</fore... |
<vulnerable_code> /*
Convert stripped TIFF image.
*/
extent=4*(samples_per_pixel+1)*TIFFStripSize(tiff);
strip_pixels=(unsigned char *) AcquireQuantumMemory(extent,
sizeof(*strip_pixels));
if (strip_pixels == (unsigned char *) NULL)<commit_title>[PATCH] squash ... |
<vulnerable_code> try:
header = header_from_binary(buf)
except NotEnoughData:
logger.debug('Not enough data while parsing header from client, waiting for more')
return
if len(buf) < header.body_size:
... |
<vulnerable_code># coding: utf-8
import asyncio
import pytest
from asyncua import Client, Server
from asyncua.ua.uaerrors import BadMaxConnectionsReached
from .conftest import port_num, find_free_port
pytestmark = pytest.mark.asyncio
opc.server.iserver.isession.__class__.max_connections = 1000
async def test_s... |
<vulnerable_code><commit_title>[PATCH] Rewrite CORS enforcement and offline extension cache<commit_description>This fixes the offline extension cache.
Also added an option to force CORS to be enabled.<fixed_code>
import {ipcMain} from 'electron';
import {get, set} from './store';
const BYPASS_CORS_KEY = 'bypass_cors';... |
<vulnerable_code>import {app, protocol} from 'electron';
import pathUtil from 'path';
import {staticDir} from './environment';
const extensionDirectory = pathUtil.join(staticDir, 'extensions.turbowarp.org', '/');
app.on('session-created', (session) => {
session.webRequest.onBeforeRequest({
urls: ['https://exten... |
<vulnerable_code> });
}
});
const rootFileURL = new URL(`file://${__dirname}/`).href;
// Enforce additional restrictions when fetching file:// URIs
session.webRequest.onBeforeRequest((details, callback) => {
const destinationURL = new URL(details.url);
if (destinationURL.protocol === 'file:' ... |
<vulnerable_code> sect->vaddr += page_zero_size;
}
cursor += word_size;
if (cursor >= end) {
break;
}
sect->size = r_read_ble (cursor, false, bits);
cursor += word_size;
if (cursor >= end) {
break;
}
ut64 sect_name_off = r_read_ble (cursor, false, bits);
cursor += word_size;
... |
<vulnerable_code> struct SCP_SESSION *session = 0;
tui16 sz;
tui32 code = 0;
char buf[257];
if (!skipVchk)
{
/* reading username */
in_uint16_be(c->in_s, sz);
buf[sz] = '\0';
in_uint8a(c->in_s, buf, sz);
if (0 != scp_session_set_username(session, buf))
... |
<vulnerable_code> cursor.execute(
"""
SELECT hosts.hostname AS hostname,
hosts.mac AS mac,
hosts.description AS description,
STRING_AGG(DISTINCT((SELECT CAST(addresses.address AS VARCHAR))), ', ') AS addresses,
... |
<vulnerable_code>void mctp_dev_put(struct mctp_dev *mdev)
{
if (mdev && refcount_dec_and_test(&mdev->refs)) {
dev_put(mdev->dev);
kfree_rcu(mdev, rcu);
}
mctp_route_remove_dev(mdev);
mctp_neigh_remove_dev(mdev);
kfree(mdev->addrs);
mctp_dev_put(mdev);
}<commit_title>[PATCH] mctp: defer the kfree of object m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.