code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
def post(self, request, **kwargs): playbook_id = kwargs.get('pk') playbook = get_object_or_404(Playbook, id=playbook_id) work_path = playbook.work_dir parent_key = request.data.get('key', '') if parent_key == 'root': parent_key = '' if os.path.dirname(parent_...
vuln
Vulnerable
Python
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 sock *sk; int len; dcid = __le16_to_cpu(req->dcid); flags = __le16_to_cpu(req->flags); BT_DBG("dcid ...
vuln
Safe
Unknown
ArgParser::argOiMinHeight(char* parameter) { o.oi_min_height = QUtil::string_to_uint(parameter); }
vuln
Safe
Unknown
if(!self.define){const e=e=>{"require"!==e&&(e+=".js");let r=Promise.resolve();return i[e]||(r=new Promise((async r=>{if("document"in self){const i=document.createElement("script");i.src=e,document.head.appendChild(i),i.onload=r}else importScripts(e),r()}))),r.then((()=>{if(!i[e])throw new Error(`Module ${e} didn’t reg...
vuln
Vulnerable
JavaScript
private void getRealChannelAdminCount() { TLRPC.TL_channels_getParticipants req = new TLRPC.TL_channels_getParticipants(); req.channel = getMessagesController().getInputChannel(chatId); req.filter = new TLRPC.TL_channelParticipantsAdmins(); int reqId = getConnectionsManager().sendRequest...
vuln
Vulnerable
Java
int virtualbox_get_guest_property(char *name, void **value, size_t *size) { // connect uint32_t client_id; int ret = start_connection(&client_id); if (ret < 0) { return ret; } int _cleanup_close_ fd = ret; // get property ret = get_prop(fd, client_id, name, value, size); if (ret != VINF_SUCCESS) { disconn...
vuln
Safe
C/C++
horizontalDifference8(unsigned char *ip, int n, int stride, unsigned short *wp, uint16 *From8) { register int r1, g1, b1, a1, r2, g2, b2, a2, mask; #undef CLAMP #define CLAMP(v) (From8[(v)]) mask = CODE_MASK; if (n >= stride) { if (stride == 3) { r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(i...
vuln
Safe
C/C++
@SubscribeEvent(receiveCanceled = true) public void onChat(ClientChatReceivedEvent event) { if (ToggleCommand.autoAcceptReparty) { String message = StringUtils.stripControlCodes(event.message.getUnformattedText()); if (message.contains(":")) return; String[] split = me...
vuln
Safe
Java
@Override public NbtCompound toTag() { NbtCompound tag = saveGeneral(); NbtList valueTag = new NbtList(); for (Enchantment ench : get()) { valueTag.add(NbtString.of(Registry.ENCHANTMENT.getId(ench).toString())); } tag.put("value", valueTag); return tag; ...
vuln
Vulnerable
Java
hfs_cat_traverse(HFS_INFO * hfs, TSK_HFS_BTREE_CB a_cb, void *ptr) { TSK_FS_INFO *fs = &(hfs->fs_info); uint32_t cur_node; /* node id of the current node */ char *node; uint16_t nodesize; uint8_t is_done = 0; tsk_error_reset(); nodesize = tsk_getu16(fs->endian, hfs->catalog_h...
vuln
Safe
Unknown
bool throttle_is_valid(ThrottleConfig *cfg, Error **errp) { int i; bool bps_flag, ops_flag; bool bps_max_flag, ops_max_flag; bps_flag = cfg->buckets[THROTTLE_BPS_TOTAL].avg && (cfg->buckets[THROTTLE_BPS_READ].avg || cfg->buckets[THROTTLE_BPS_WRITE].avg); ops_flag = cfg...
vuln
Vulnerable
C/C++
@Override protected boolean visitFrame(Pointer sp, CodePointer ip, CodeInfo codeInfo, DeoptimizedFrame deoptimizedFrame, Object data) { SamplingStackVisitor.StackTrace stackTrace = (SamplingStackVisitor.StackTrace) data; VMError.guarantee(stackTrace.num < StackTrace.MAX_STACK_DEPTH, "The call stack ...
vuln
Vulnerable
Java
TfLiteStatus EvalHashtableSize(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input_resource_id_tensor = GetInput(context, node, kInputResourceIdTensor); int resource_id = input_resource_id_tensor->data.i32[0]; TfLiteTensor* output_tensor = GetOutput(context, node, kOutputTensor); auto* ...
vuln
Vulnerable
C/C++
function csrfProtection (req, reply, next) { const secret = getSecret(req, reply) if (!secret) { req.log.warn('Missing csrf secret') return reply.send(new Forbidden('Missing csrf secret')) } if (!tokens.verify(secret, getToken(req))) { req.log.warn('Invalid csrf token') return re...
vuln
Vulnerable
JavaScript
/** * Given an Accept header and a list of possible content types, pick * the most suitable one to respond with * @param {string} accept * @param {string[]} types */ export function negotiate(accept, types) { /** @type {Array<{ type: string, subtype: string, q: number, i: number }>} */ const parts = []; accept...
vuln
Safe
JavaScript
@Override public boolean onUpdate(int currentTick) { if (this.closed) { return false; } if (this.server.getDifficulty() < 1) { this.close(); return false; } if (!this.isAlive()) { if (++this.deadTicks >= 23) { ...
vuln
Safe
Java
static boolean my_fill_input_buffer_fn(j_decompress_ptr cinfo) { struct iwjpegrcontext *rctx = (struct iwjpegrcontext*)cinfo->src; size_t bytesread = 0; int ret; ret = (*rctx->iodescr->read_fn)(rctx->ctx,rctx->iodescr, rctx->buffer,rctx->buffer_len,&bytesread); if(!ret) return FALSE; rctx->pub.next_input_byte...
vuln
Vulnerable
C/C++
Uri updateMediaProvider(@NonNull ContentProviderClient mediaProvider, @NonNull ContentValues mediaValues) { final String filePath = mediaValues.getAsString(MediaStore.DownloadColumns.DATA); Uri mediaStoreUri = getMediaStoreUri(mediaProvider, filePath); try { if (mediaSto...
vuln
Safe
Java
static inline int get_amv(Mpeg4DecContext *ctx, int n) { MpegEncContext *s = &ctx->m; int x, y, mb_v, sum, dx, dy, shift; int len = 1 << (s->f_code + 4); const int a = s->sprite_warping_accuracy; if (s->workaround_bugs & FF_BUG_AMV) len >>= s->quarter_sample; if (s->real_sprite_warpi...
vuln
Safe
C/C++
/* * Copyright (c) 1999-2013 Petko Manolov (petkan@nucleusys.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * ChangeLog: * .... Most of the time spent on reading so...
vuln
Vulnerable
C/C++
public static void shareText(@NonNull final Context context, @NonNull final String title, final String content, final String imagePreviewUrl) { final Intent shareIntent = new Intent(Intent.ACTION_SEND); sh...
vuln
Vulnerable
Java
def get(self, user_id): """ Fetch data for user with corresponding user_id """ return database_utilities.execute_query(f"""select * from users where user_id = %s""", (user_id, ))
vuln
Safe
Python
proc_file_lseek(struct file *file, loff_t offset, int orig) { loff_t retval = -EINVAL; switch (orig) { case 1: offset += file->f_pos; /* fallthrough */ case 0: if (offset < 0 || offset > MAX_NON_LFS) break; file->f_pos = retval = offset; } return retval; }
vuln
Safe
Unknown
int h263_decode_picture_header(MpegEncContext *s) { int format, width, height; if (get_bits(&s->gb, 22) != 0x20) return -1; skip_bits(&s->gb, 8); if (get_bits1(&s->gb) != 1) return -1; if (get_bits1(&s->gb) != 0) return -1; skip_bits1(&s->gb); skip_bits1(&s->...
vuln
Vulnerable
C/C++
float av_int2flt(int32_t v){ if((uint32_t)v+v > 0xFF000000U) return NAN; return ldexp(((v&0x7FFFFF) + (1<<23)) * (v>>31|1), (v>>23&0xFF)-150); }
vuln
Safe
C/C++
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.collapsing_toolbar_base_layout, container, false); mCollapsingToolbarLayout...
vuln
Vulnerable
Java
static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *segment) { int i, length; segment->nb_index_entries = avio_rb32(pb); length = avio_rb32(pb); if (!(segment->temporal_offset_entries=av_calloc(segment->nb_index_entries, sizeof(*segment->temporal_offset_entries))) || ...
vuln
Vulnerable
Unknown
import re from pathlib import Path from urllib.parse import unquote import base64 import json, os, requests, time, pytz, pymongo from shutil import rmtree from requests.exceptions import ConnectionError from os.path import join, exists from django.shortcuts import render from django.core.serializers import serialize fr...
vuln
Safe
Python
x[C].apply(this,arguments);null!=G&&B.push(G)}b.sidebar.showEntries(0<B.length?B.join(";"):"",A.checked);b.hideDialog()});g.className="geBtn gePrimaryBtn";f=document.createElement("div");f.style.marginTop="26px";f.style.textAlign="right"}b.editor.cancelFirst?(f.appendChild(n),f.appendChild(g)):(f.appendChild(g),f.appen...
vuln
Safe
JavaScript
def get_capabilities(request, layerid=None, user=None, mapid=None, category=None, tolerant=False): """ Compile a GetCapabilities document containing public layers filtered by layer, user, map, or category """ rootdoc = None layers = None cap_name = ' Capabilities - ' ...
vuln
Safe
Python
/******************************************************************************* * This file is part of OpenNMS(R). * * Copyright (C) 2002-2014 The OpenNMS Group, Inc. * OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc. * * OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc. * * OpenNMS(...
vuln
Vulnerable
Java
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # CherryMusic - a standalone music server # Copyright (c) 2012 - 2015 Tom Wallroth & Tilman Boerner # # Project page: # http://fomori.org/cherrymusic/ # Sources on github: # http://github.com/devsnd/cherrymusic/ # # CherryMusic is based on # jPlayer (GPL/MIT licens...
vuln
Safe
Python
# This file is part of cloud-init. See LICENSE file for license information. """schema.py: Set of module functions for processing cloud-config schema.""" import argparse import json import logging import os import re import sys import textwrap import typing from collections import defaultdict from copy import deepcopy...
vuln
Vulnerable
Python
@Override public Point2 config(){ return Point2.unpack(link).sub(tile.x, tile.y); }
vuln
Vulnerable
Java
MagickExport void RemoveDuplicateLayers(Image **images, MagickExport void RemoveDuplicateLayers(Image **images,ExceptionInfo *exception) { RectangleInfo bounds; register Image *image, *next; assert((*images) != (const Image *) NULL); assert((*images)->signature == MagickCoreSignature); if...
vuln
Safe
C/C++
int adjust_plines_for_skipcol(win_T *wp) { if (wp->w_skipcol == 0) return 0; int width = wp->w_width - win_col_off(wp); int w2 = width + win_col_off2(wp); if (wp->w_skipcol >= width && w2 > 0) return (wp->w_skipcol - width) / w2 + 1; return 0; }
vuln
Safe
C/C++
static void fill_coding_method_array(sb_int8_array tone_level_idx, sb_int8_array tone_level_idx_temp, sb_int8_array coding_method, int nb_channels, int c, int superblocktyp...
vuln
Vulnerable
C/C++
public synchronized static void complete(long endTime, boolean canSendPacket) { if (INSTANCE.isCompleted || !INSTANCE.isStarted()) return; // Init additional data INSTANCE.isHardcore = InGameTimerUtils.isHardcoreWorld(); COMPLETED_INSTANCE = new Gson().fromJson(new Gson().toJson(INSTAN...
vuln
Safe
Java
# -*- coding: utf-8 -*- ''' Execute chef in server or solo mode ''' # Import Python libs import logging import os # Import Salt libs import salt.utils import salt.utils.decorators as decorators log = logging.getLogger(__name__) def __virtual__(): ''' Only load if chef is installed ''' if not salt.u...
vuln
Vulnerable
Python
@WorkerThread public static void extract(@NonNull @TarType String type, @NonNull File[] sources, @NonNull File dest, @Nullable String[] filters, @Nullable String[] exclude) throws IOException, RemoteException { try (SplitInputStream sis = new SplitInputStream(so...
vuln
Safe
Java
static void bonito_ldma_writel(void *opaque, hwaddr addr, uint64_t val, unsigned size) { PCIBonitoState *s = opaque; ((uint32_t *)(&s->bonldma))[addr/sizeof(uint32_t)] = val & 0xffffffff;
vuln
Vulnerable
C/C++
@VisibleForTesting @Nonnull CompletableFuture<Void> scrubIndexAsync(ScrubbingType type, AtomicLong count) { return AsyncUtil.composeHandle( getScrubber(type, count).buildIndexAsync(false), (ignore, ex) -> { if (ex != null) { thr...
vuln
Vulnerable
Java
private IAIState chopTree() { worker.getCitizenStatusHandler().setLatestStatus(Component.translatable("com.minecolonies.coremod.status.chopping")); final boolean shouldBreakLeaves = building.shouldDefoliate() || job.getTree().isNetherTree(); if (job.getTree().hasLogs() || (shouldBreakLeave...
vuln
Vulnerable
Java
static int xan_decode_chroma(AVCodecContext *avctx, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; XanContext *s = avctx->priv_data; uint8_t *U, *V; unsigned chroma_off; int val, uval, vval; int i, j; const uint8_t *src, *src_end; const uint8_t *table; int mode, offset, dec_siz...
vuln
Safe
C/C++
package server import ( "net/http" "github.com/labstack/echo/v4" "github.com/usememos/memos/api" "github.com/usememos/memos/common" ) type response struct { Data interface{} `json:"data"` } func composeResponse(data interface{}) response { return response{ Data: data, } } func DefaultGetRequestSkipper(c e...
vuln
Safe
Go
static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path, const char *name, V9fsPath *target) { if (dir_path) { v9fs_path_sprintf(target, "%s/%s", dir_path->data, name); } else if (strcmp(name, "/")) { v9fs_path_sprintf(target, "%s", name); } else { ...
vuln
Safe
C/C++
def auto_unlock_tasks(project_id: int): """Unlock all tasks locked for longer than the auto-unlock delta""" expiry_delta = Task.auto_unlock_delta() lock_duration = (datetime.datetime.min + expiry_delta).time().isoformat() expiry_date = datetime.datetime.utcnow() - expiry_delta ol...
vuln
Safe
Python
static bool tailmatch(const char *little, const char *bigone) { size_t littlelen = strlen(little); size_t biglen = strlen(bigone); if(littlelen > biglen) return FALSE; return Curl_raw_equal(little, bigone+biglen-littlelen) ? TRUE : FALSE; }
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
/* * Copyright 2000-2020 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
vuln
Safe
Java
function initEnv() { $iParams = array("reqURI" => array(tlInputParameter::STRING_N,0,4000)); $pParams = G_PARAMS($iParams); $args = new stdClass(); $args->ssodisable = getSSODisable(); // CWE-79: // Improper Neutralization of Input // During Web Page Generation ('Cross-site Scripting') // // ht...
vuln
Safe
PHP
public static long extractFilesFromJar(JarFile jarFile, File targetDir, FileFilter filter) throws IOException { long totalBytes = 0; byte[] block = new byte[4096]; Enumeration<JarEntry> jarList = jarFile.entries(); while (jarList.hasMoreElements()) { JarEntry jarEntry = jarList.nextEleme...
vuln
Vulnerable
Java
def verify(self, **kwargs): super(IdToken, self).verify(**kwargs) try: if kwargs["iss"] != self["iss"]: raise IssuerMismatch("{} != {}".format(kwargs["iss"], self["iss"])) except KeyError: pass if "aud" in self: if "client_id" in kwar...
vuln
Safe
Python
static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, void *data, int *got_frame, const uint8_t *buf, int buf_size) { FlicDecodeContext *s = avctx->priv_data; GetByteContext g2; int pixel_ptr; unsigned char pale...
vuln
Safe
C/C++
static int trusted_update(struct key *key, struct key_preparsed_payload *prep) { struct trusted_key_payload *p; struct trusted_key_payload *new_p; struct trusted_key_options *new_o; size_t datalen = prep->datalen; char *datablob; int ret = 0; if (key_is_negative(key)) return -ENOKEY; p = key->payload.data[0]...
vuln
Safe
Unknown
var mxClient={VERSION:"18.0.3",IS_IE:null!=navigator.userAgent&&0<=navigator.userAgent.indexOf("MSIE"),IS_IE11:null!=navigator.userAgent&&!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:null!=navigator.userAgent&&!!navigator.userAgent.match(/Edge\//),IS_EM:"spellcheck"in document.createElement("textarea")&&8==docum...
vuln
Vulnerable
JavaScript
static int _snd_timer_stop(struct snd_timer_instance * timeri, int keep_flag, int event) { struct snd_timer *timer; unsigned long flags; if (snd_BUG_ON(!timeri)) return -ENXIO; if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) { if (!keep_flag) { spin_lock_irqsave(&slave_active_lock, flags); timeri->...
vuln
Safe
C/C++
public static ShortcutPackage loadFromXml(ShortcutService s, ShortcutUser shortcutUser, TypedXmlPullParser parser, boolean fromBackup) throws IOException, XmlPullParserException { final String packageName = ShortcutService.parseStringAttribute(parser, ATTR_NAME); ...
vuln
Vulnerable
Java
static int fts3IncrmergeLoad( Fts3Table *p, /* Fts3 table handle */ sqlite3_int64 iAbsLevel, /* Absolute level of input segments */ int iIdx, /* Index of candidate output segment */ const char *zKey, /* First key to write */ int nKey, ...
vuln
Vulnerable
Unknown
ImagingConvertTransparent(Imaging imIn, const char *mode, int r, int g, int b) { ImagingSectionCookie cookie; ImagingShuffler convert; Imaging imOut = NULL; int y; if (!imIn) { return (Imaging)ImagingError_ModeError(); } if (!((strcmp(imIn->mode, "RGB") == 0 || strcmp(imIn->mode, "...
vuln
Vulnerable
Unknown
static int open_file(AVFormatContext *avf, unsigned fileno) { ConcatContext *cat = avf->priv_data; ConcatFile *file = &cat->files[fileno]; int ret; if (cat->avf) avformat_close_input(&cat->avf); cat->avf = avformat_alloc_context(); if (!cat->avf) return AVERROR(ENOMEM); cat->...
vuln
Safe
C/C++
def activity_user user = current_user.pref[:activity_user] if user && user != "all_users" user = if user =~ /@/ # email User.where(:email => user).first else # first_name middle_name last_name any_name name_query = if user.include?(" ") user.name_permutations.map{ |...
vuln
Safe
Ruby
#!/usr/bin/env python # -*- coding: utf-8 -*- """ | This file is part of the web2py Web Framework | Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> | License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) Contains the classes for the global used variables: - Request - Response - Session """ from gluon....
vuln
Vulnerable
Python
av_cold void ff_psy_preprocess_end(struct FFPsyPreprocessContext *ctx) { int i; ff_iir_filter_free_coeffs(ctx->fcoeffs); if (ctx->fstate) for (i = 0; i < ctx->avctx->channels; i++) ff_iir_filter_free_state(ctx->fstate[i]); av_freep(&ctx->fstate); }
vuln
Vulnerable
C/C++
ACPI_STATUS AcpiDsCreateOperands ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *FirstArg) { ACPI_STATUS Status = AE_OK; ACPI_PARSE_OBJECT *Arg; ACPI_PARSE_OBJECT *Arguments[ACPI_OBJ_NUM_OPERANDS]; UINT32 ArgCount = 0; UINT32 ...
vuln
Vulnerable
C/C++
ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id, char *buf, size_t buflen) { LIBSSH2_SESSION *session = channel->session; int rc; size_t bytes_read = 0; size_t bytes_want; int unlink_packet; LIBSSH2_PACKET *read_packet; LIBSSH2_PACKET *read...
vuln
Safe
Unknown
void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr) { CPUState *cpu; PageDesc *p; uint32_t h; tb_page_addr_t phys_pc; assert_tb_locked(); atomic_set(&tb->cflags, tb->cflags | CF_INVALID); phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK); h = tb_hash_func...
vuln
Safe
C/C++
public AuthenticatedDB getDataStoreForToken(String token, Map<String, String> headers) throws UnauthorizedException { AuthenticationSubject authenticationSubject = authenticationService.validateToken(token, headers); DataStore dataStore = dataStoreFactory.create( authentication...
vuln
Vulnerable
Java
int main(void) { size_t rd; yajl_val node; char errbuf[1024]; /* memory allocation debugging: allocate a structure which holds * allocation routines */ yajl_alloc_funcs allocFuncs = { yajlTestMalloc, yajlTestRealloc, yajlTestFree, (void *) NULL }; /* me...
vuln
Safe
C/C++
unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { struct hstate *h = hstate_file(file); struct mm_struct *mm = current->mm; struct vm_area_struct *vma; if (len & ~huge_page_mask(h)) return -EINVAL; if (len > TASK_SIZE)...
vuln
Safe
Unknown
static void aio_complete_rw(struct kiocb *kiocb, long res, long res2) { struct aio_kiocb *iocb = container_of(kiocb, struct aio_kiocb, rw); if (!list_empty_careful(&iocb->ki_list)) aio_remove_iocb(iocb); if (kiocb->ki_flags & IOCB_WRITE) { struct inode *inode = file_inode(kiocb->ki_filp); /* * Tell lockd...
vuln
Vulnerable
Unknown
static Image *ReadPCLImage(const ImageInfo *image_info,ExceptionInfo *exception) { #define CropBox "CropBox" #define DeviceCMYK "DeviceCMYK" #define MediaBox "MediaBox" #define RenderPCLText " Rendering PCL... " char command[MagickPathExtent], *density, filename[MagickPathExtent], geometry[Magi...
vuln
Safe
C/C++
static int ssl_verify_cert(struct tunnel *tunnel) { int ret = -1; int cert_valid = 0; unsigned char digest[SHA256LEN]; unsigned int len; struct x509_digest *elem; char digest_str[SHA256STRLEN], *subject, *issuer; char *line; int i; X509_NAME *subj; SSL_set_verify(tunnel->ssl_handle, SSL_VERIFY_PEER, NULL); ...
vuln
Safe
C/C++
ds_fgetstr (FILE *f, dynamic_string *s, char eos) { int insize; /* Amount needed for line. */ int strsize; /* Amount allocated for S. */ int next_ch; /* Initialize. */ insize = 0; strsize = s->ds_length; /* Read the input string. */ next_ch = getc (f); while (next_ch != eos && next_ch != EOF...
vuln
Vulnerable
Unknown
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % M M AAA TTTTT L AAA BBBB ...
vuln
Vulnerable
C/C++
static PyObject *__pyx_f_17clickhouse_driver_14bufferedwriter___pyx_unpickle_BufferedWriter__set_state(struct __pyx_obj_17clickhouse_driver_14bufferedwriter_BufferedWriter *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; cha...
vuln
Vulnerable
C/C++
return ka}function B(){function fa(ta,ka){var Ja=mxResources.get(ta);null==Ja&&(Ja=ta.substring(0,1).toUpperCase()+ta.substring(1));18<Ja.length&&(Ja=Ja.substring(0,18)+"&hellip;");return Ja+" ("+ka.length+")"}function sa(ta,ka,Ja){mxEvent.addListener(ka,"click",function(){Ha!=ka&&(Ha.style.backgroundColor="",Ha=ka,Ha....
vuln
Safe
JavaScript
/* +----------------------------------------------------------------------+ | HipHop for PHP | +----------------------------------------------------------------------+ | Copyright (c) 2010-2016 Facebook, Inc. (http://www.facebook.com) | | Copyrigh...
vuln
Vulnerable
C/C++
@Override public void run() { if (formatter == null) return; handler.post(() -> view.setText(formatter.format(new Date()))); }
vuln
Safe
Java
def post(self): if (request.environ['CONTENT_TYPE'].split(';', 1)[0] == "application/json"): try: para = request.get_json() except Exception as e: resp = make_response(("The json data can't be parsed", 403, )) return resp try: ...
vuln
Safe
Python
static void unzzip_mem_entry_fprint(ZZIP_MEM_DISK* disk, ZZIP_MEM_ENTRY* entry, FILE* out) { ZZIP_DISK_FILE* file = zzip_mem_entry_fopen (disk, entry); if (file) { char buffer[1024]; int len; while ((len = zzip_mem_disk_fread (buffer, 1024, 1, file))) fwrite (buffer, len, 1, out); zzip_mem...
vuln
Vulnerable
C/C++
@Override public R execute(ServiceProvider context) { final Collection<Request<?, ?>> requests = getNestedRequests(); // if a User object is already attached to the context, that means we have already authenticated the user, no need to do it again User user = context.optionalService(User.class).orElse(null); ...
vuln
Safe
Java
static void qxl_destroy_primary(PCIQXLDevice *d) { if (d->mode == QXL_MODE_UNDEFINED) { return; } dprint(d, 1, "%s\n", __FUNCTION__); d->mode = QXL_MODE_UNDEFINED; d->ssd.worker->destroy_primary_surface(d->ssd.worker, 0); }
vuln
Vulnerable
C/C++
static int mov_read_custom(MOVContext *c, AVIOContext *pb, MOVAtom atom) { int64_t end = avio_tell(pb) + atom.size; uint8_t *key = NULL, *val = NULL, *mean = NULL; int i; AVStream *st; MOVStreamContext *sc; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]...
vuln
Vulnerable
C/C++
def patch_bot_backend( request: HttpRequest, user_profile: UserProfile, bot_id: int, full_name: Optional[str] = REQ(default=None), role: Optional[int] = REQ( default=None, json_validator=check_int_in( UserProfile.ROLE_TYPES, ), ), bot_owner_id: Optional[in...
vuln
Vulnerable
Python
public static int getPlaybackBuffer() { int confVal = SettingsEnum.PLAYBACK_MAX_BUFFER_INTEGER.getInt(); if (confVal < 1) confVal = 1; return confVal; }
vuln
Safe
Java
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #define DEBUG_TYPE "vm" #include "hermes/VM/Interpreter.h" #include "hermes/VM/Runtime.h" #include "hermes/Inst/InstDecode.h" #i...
vuln
Vulnerable
C/C++
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2005-2012 * All rights reserved * * This file is part of GPAC / command-line client * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General ...
vuln
Vulnerable
C/C++
void checkVerificationCodeUnexistingUser() throws ResetPasswordException { when(this.userReference.toString()).thenReturn("user:Foobar"); when(this.userManager.exists(this.userReference)).thenReturn(false); ResetPasswordRequestResponse resetPasswordRequestResponse = this.resetPas...
vuln
Safe
Java
static int cd_read_sector(IDEState *s, int lba, uint8_t *buf, int sector_size) { int ret; switch(sector_size) { case 2048: block_acct_start(blk_get_stats(s->blk), &s->acct, 4 * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ); ret = blk_read(s->blk, (int64_t)lba << 2, buf, 4); ...
vuln
Vulnerable
C/C++
int ParseCaffHeaderConfig (FILE *infile, char *infilename, char *fourcc, WavpackContext *wpc, WavpackConfig *config) { uint32_t chan_chunk = 0, desc_chunk = 0, channel_layout = 0, bcount; unsigned char *channel_identities = NULL; unsigned char *channel_reorder = NULL; int64_t total_samples = 0, infilesi...
vuln
Safe
Unknown
doit (void) { char *badutf8 = strdup ("\x7e\x64\x61\x72\x10\x2f\x2f\xf9\x2b\x71" "\x60\x79\x7b\x2e\x63\x75\x2b\x61\x65\x72" "\x75\x65\x56\x66\x7f\x62\xc5\x76\xe5\x00"); char *s = NULL; int rc; rc = idna_to_ascii_8z (badutf8, &s, 0); free (badutf8); if (rc != IDNA_ICONV_ERROR) fail ("rc %d\n",...
vuln
Safe
Unknown
function peg$parsesigned_integer() { var s0, s1, s2; peg$silentFails++; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 45) { s1 = peg$c54; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c55); } } if (...
vuln
Safe
JavaScript
static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size) { SerialState *s = opaque; uint32_t ret; addr &= 7; switch(addr) { default: case 0: if (s->lcr & UART_LCR_DLAB) { ret = s->divider & 0xff; } else { if(s->fcr & UART_FCR_FE) { ...
vuln
Vulnerable
C/C++
static int ExecuteSQL( SQLHDBC hDbc, char *szSQL, char cDelimiter, int bColumnNames, int bHTMLTable ) { SQLHSTMT hStmt; SQLTCHAR szSepLine[32001]; SQLTCHAR szUcSQL[32001]; SQLSMALLINT cols; SQLINTEGER ret; SQLLEN nRows = 0; szSepL...
vuln
Safe
C/C++
int doDrain(WithSizeConsumer<S> consumer, DataWrapper<S> firstPoll) { int drainedCount = 0; int drainedSizeInBytes = 0; DataWrapper<S> next = firstPoll; do { int nextSizeInBytes = next.getSizeInBytes(); if (consumer.offer(next.getElement(), nextSizeInBytes)) { ...
vuln
Vulnerable
Java
static av_cold int bfi_decode_init(AVCodecContext *avctx) { BFIContext *bfi = avctx->priv_data; avctx->pix_fmt = AV_PIX_FMT_PAL8; bfi->dst = av_mallocz(avctx->width * avctx->height); return 0; }
vuln
Vulnerable
C/C++
i_alloc_struct_array(gs_memory_t * mem, uint num_elements, gs_memory_type_ptr_t pstype, client_name_t cname) { gs_ref_memory_t * const imem = (gs_ref_memory_t *)mem; obj_header_t *obj; #ifdef MEMENTO if (Memento_failThisEvent()) return NULL; #endif ALLOC_CHECK_SIZE(mem,pst...
vuln
Vulnerable
Unknown
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. import csv import six from babel.dates import format_datetime from...
vuln
Vulnerable
Python
static char *clean_path(char *path) { char *ch; char *ch2; char *str; str = xmalloc(strlen(path) + 1); ch = path; ch2 = str; while (true) { *ch2 = *ch; ch++; ch2++; if (!*(ch-1)) break; while (*(ch - 1) == '/' && *ch == '/') ch++; } /* get rid of trailing / characters */ while ((ch = strrchr(s...
vuln
Safe
C/C++