code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
void hmp_info_migrate(Monitor *mon, const QDict *qdict) { MigrationInfo *info; MigrationCapabilityStatusList *caps, *cap; info = qmp_query_migrate(NULL); caps = qmp_query_migrate_capabilities(NULL); if (info->has_status && caps) { monitor_printf(mon, "capabilities: "); for (cap ...
vuln
Vulnerable
C/C++
var contra = require("contra"), path = require("path"), fUtils = require("./files"), cp = require("child_process"); var gitApp = "git", gitExtra = { env: process.env }; var escapeQuotes = function (str) { if (typeof str === "string") { return '"' + str.replace(/(["'$`\\])/g, "\\$1") + '"'; } else { ...
vuln
Safe
JavaScript
K)));T=!0;for(var N=0;N<this.customFonts.length;N++)if(this.customFonts[N].name==D){T=!1;break}T&&(this.customFonts.push({name:D,url:K}),this.editorUi.fireEvent(new mxEventObject("customFontsChanged","customFonts",this.customFonts)))}finally{V.getModel().endUpdate()}}}));this.editorUi.showDialog(W.container,380,Editor....
vuln
Safe
JavaScript
static int cit_get_packet_size(struct gspca_dev *gspca_dev) { struct usb_host_interface *alt; struct usb_interface *intf; intf = usb_ifnum_to_if(gspca_dev->dev, gspca_dev->iface); alt = usb_altnum_to_altsetting(intf, gspca_dev->alt); if (!alt) { pr_err("Couldn't get altsetting\n"); return -EIO; } return le...
vuln
Vulnerable
C/C++
public static long singlePlayerCrackRNG() { ServerPlayerEntity serverPlayer = MinecraftClient.getInstance().getServer().getPlayerManager().getPlayer(MinecraftClient.getInstance().player.getUuid()); long seed = getSeed(serverPlayer.getRandom()); setSeed(seed); EnchantmentCracker.possible...
vuln
Vulnerable
Java
static int dpcm_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) { DPCMContext *s = avctx->priv_data; int in, out = 0; int predictor[2]; int channel_number = 0; short *output_samples = data; int ...
vuln
Vulnerable
C/C++
import os import tempfile from galaxy import model from galaxy.util.bunch import Bunch from galaxy.util.none_like import NoneDataset from galaxy.util.template import fill_template from galaxy.tools.wrappers import ( DatasetFilenameWrapper, DatasetListWrapper, DatasetCollectionWrapper, LibraryDatasetVal...
vuln
Vulnerable
Python
static int check_map_func_compatibility(struct bpf_verifier_env *env, struct bpf_map *map, int func_id) { if (!map) return 0; /* We need a two way check, first is from map perspective ... */ switch (map->map_type) { case BPF_MAP_TYPE_PROG_ARRAY: if (func_id != BPF_FUNC_tail_call) goto error; break; ...
vuln
Safe
C/C++
vcard_apdu_new(unsigned char *raw_apdu, int len, vcard_7816_status_t *status) { VCardAPDU *new_apdu; *status = VCARD7816_STATUS_EXC_ERROR_MEMORY_FAILURE; if (len < 4) { *status = VCARD7816_STATUS_ERROR_WRONG_LENGTH; return NULL; } new_apdu = g_new(VCardAPDU, 1); new_apdu->a_dat...
vuln
Vulnerable
Unknown
static void onRestoreComplete(int returnCode, Context context, IntentSender target) { Intent fillIn = new Intent(); fillIn.putExtra(PackageInstaller.EXTRA_STATUS, PackageManager.installStatusToPublicStatus(returnCode)); try { final BroadcastOptions options = Broadcast...
vuln
Safe
Java
int Exiv2::http(Exiv2::Dictionary& request,Exiv2::Dictionary& response,std::string& errors) { if ( !request.count("verb") ) request["verb" ] = "GET"; if ( !request.count("header") ) request["header" ] = "" ; if ( !request.count("version")) request["version"] = "1.0"; if ( !request.count("port") ...
vuln
Vulnerable
C/C++
void ModuleSQL::init() { if (mysql_library_init(0, NULL, NULL)) throw ModuleException("Unable to initialise the MySQL library!"); Dispatcher = new DispatcherThread(this); ServerInstance->Threads->Start(Dispatcher); Implementation eventlist[] = { I_OnRehash, I_OnUnloadModule }; ServerInstance->Modules->Attach(e...
vuln
Safe
Unknown
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # 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 Foundation, either version ...
vuln
Safe
Python
_PUBLIC_ char *strupper_talloc_n_handle(struct smb_iconv_handle *iconv_handle, TALLOC_CTX *ctx, const char *src, size_t n) { size_t size=0; char *dest; if (!src) { return NULL; } /* this takes advantage of the fact that upper/lower can't change the length of a character by more than 1 byte */ dest = ...
vuln
Vulnerable
Unknown
public static FluidFuelInventorySlot forFuel(IExtendedFluidTank fluidTank, ToIntFunction<@NonNull ItemStack> fuelValue, Int2ObjectFunction<@NonNull FluidStack> fuelCreator, @Nullable IContentsListener listener, int x, int y) { Objects.requireNonNull(fluidTank, "Fluid tank cannot be null"); Obj...
vuln
Safe
Java
void AuthorizationSessionImpl::_refreshUserInfoAsNeeded(OperationContext* opCtx) { AuthorizationManager& authMan = getAuthorizationManager(); UserSet::iterator it = _authenticatedUsers.begin(); while (it != _authenticatedUsers.end()) { auto& user = *it; if (!user->isValid()) { /...
vuln
Safe
Unknown
@SuppressLint("NewApi") public void index(Project project, Runnable callback) { if (!changed(mCachedPaths, project.getFileManager().fileClasspath())) { setIndexing(false); handler.post(callback); return; } setIndexing(true); project.clear(); ...
vuln
Vulnerable
Java
public void setFavorite(Context context) { if (song.isFavorite()) { songRepository.unstar(song.getId()); song.setFavorite(false); } else { songRepository.star(song.getId()); song.setFavorite(true); if(PreferenceUtil.getInstance(context).isStar...
vuln
Safe
Java
/* Copyright 2018 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...
vuln
Safe
Python
!function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_C...
vuln
Safe
JavaScript
public static ActionResult cycleGameMode(ActionContext ctx, String arg) { if (ctx.getPlayer() != null && ctx.getClient().getConnection() != null) { String[] parts = arg.split(","); if (parts.length > 0) { ArrayList<GameType> modes = new ArrayList<...
vuln
Vulnerable
Java
static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, int source_index) { AVStream *st; OutputStream *ost; AVCodecContext *video_enc; char *frame_rate = NULL, *frame_aspect_ratio = NULL; ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index); st = ost->st; ...
vuln
Safe
C/C++
static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, size_t bufsiz) { ssize_t rc; u32 count, ordinal; unsigned long stop; if (bufsiz > TPM_BUFSIZE) bufsiz = TPM_BUFSIZE; count = be32_to_cpu(*((__be32 *) (buf + 2))); ordinal = be32_to_cpu(*((__be32 *) (buf + 6))); if (count == 0) retur...
vuln
Safe
Unknown
static int alac_decode_frame(AVCodecContext *avctx, void *outbuffer, int *outputsize, AVPacket *avpkt) { const uint8_t *inbuffer = avpkt->data; int input_buffer_size = avpkt->size; ALACContext *alac = avctx->priv_data; int channels; unsigned ...
vuln
Vulnerable
C/C++
public Map<String, String> handleCorsPreflightRequest(String pOrigin, String pRequestHeaders) { Map<String,String> ret = new HashMap<String, String>(); if (pOrigin != null && backendManager.isOriginAllowed(pOrigin,false)) { // CORS is allowed, we set exactly the origin in the header, so ther...
vuln
Safe
Java
function validateLink(url) { var BAD_PROTOCOLS = [ 'vbscript', 'javascript', 'file' ]; var str = url.trim().toLowerCase(); // Care about digital entities "javascript&#x3A;alert(1)" str = utils.replaceEntities(str); if (str.indexOf(':') !== -1 && BAD_PROTOCOLS.indexOf(str.split(':')[0]) !== -1) { return fa...
vuln
Vulnerable
JavaScript
static void win_enter_ext(win_T *const wp, const int flags) { bool other_buffer = false; const bool curwin_invalid = (flags & WEE_CURWIN_INVALID); if (wp == curwin && !curwin_invalid) { // nothing to do return; } if (!curwin_invalid && (flags & WEE_TRIGGER_LEAVE_AUTOCMDS)) { // Be careful: If...
vuln
Vulnerable
C/C++
static int webm_dash_manifest_cues(AVFormatContext *s, int64_t init_range) { MatroskaDemuxContext *matroska = s->priv_data; EbmlList *seekhead_list = &matroska->seekhead; MatroskaSeekhead *seekhead = seekhead_list->elem; char *buf; int64_t cues_start = -1, cues_end = -1, before_pos, bandwidth; i...
vuln
Safe
C/C++
static int http1_on_error(http1_parser_s *parser) { if (parser2http(parser)->close) return -1; FIO_LOG_DEBUG("HTTP parser error."); fio_close(parser2http(parser)->p.uuid); return -1; }
vuln
Safe
C/C++
float64 float64_scalbn( float64 a, int n STATUS_PARAM ) { flag aSign; int16_t aExp; uint64_t aSig; a = float64_squash_input_denormal(a STATUS_VAR); aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); aSign = extractFloat64Sign( a ); if ( aExp == 0x7FF ) { if ( aSig ) {...
vuln
Safe
C/C++
write_header( FT_Error error_code ) { FT_Face face; const char* basename; const char* format; error = FTC_Manager_LookupFace( handle->cache_manager, handle->scaler.face_id, &face ); if ( error ) Fatal( "can't access font file" ); if ( !status...
vuln
Safe
C/C++
void CoreUserInputHandler::handleSay(const BufferInfo &bufferInfo, const QString &msg) { if (bufferInfo.bufferName().isEmpty() || !bufferInfo.acceptsRegularMessages()) return; // server buffer std::function<QByteArray(const QString &, const QString &)> encodeFunc = [this] (const QString &target, const...
vuln
Safe
Unknown
static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) { struct ipv6_pinfo *np = inet6_sk(sk); struct tcp_sock *tp; struct sk_buff *opt_skb = NULL; /* Imagine: socket is IPv6. IPv4 packet arrives, goes to IPv4 receive handler and backlogged. From backlog it always goes here. Kerboom... Fortunat...
vuln
Safe
C/C++
Database.prototype.write_event = function(event) { let obj = this; let write_keyval = function(key, val) { let query = "INSERT INTO tb_events (uid, key, value) VALUES " + "(" + "'" + event.uid + "', " + "'" + key + "', " + "'" + val...
vuln
Vulnerable
JavaScript
MagickExport void XColorBrowserWidget(Display *display,XWindows *windows, const char *action,char *reply) { #define CancelButtonText "Cancel" #define ColornameText "Name:" #define ColorPatternText "Pattern:" #define GrabButtonText "Grab" #define ResetButtonText "Reset" char **colorlist, primary_select...
vuln
Vulnerable
Unknown
public KeyboardData modify_layout(KeyboardData kw) { // Update the name to avoid caching in KeyModifier final KeyValue action_key = (actionLabel == null) ? null : KeyValue.getKeyByName("action").withSymbol(actionLabel); // Extra keys are removed from the set as they are encountered during the //...
vuln
Vulnerable
Java
_WM_ParseNewMidi(uint8_t *midi_data, uint32_t midi_size) { struct _mdi *mdi; uint32_t tmp_val; uint32_t midi_type; uint8_t **tracks; uint32_t *track_size; uint32_t end_of_tracks = 0; uint32_t no_tracks; uint32_t i; uint32_t divisions = 96; uint32_t tempo = 500000; flo...
vuln
Safe
C/C++
public AuthenticationResult unlockLskfBasedProtector(IGateKeeperService gatekeeper, long protectorId, @NonNull LockscreenCredential credential, int userId, ICheckCredentialProgressCallback progressCallback) { AuthenticationResult result = new AuthenticationResult(); if (protecto...
vuln
Safe
Java
HexOutStream::overrun(size_t itemSize, size_t nItems) { if (itemSize > bufSize) throw Exception("HexOutStream overrun: max itemSize exceeded"); writeBuffer(); if (itemSize * nItems > (size_t)(end - ptr)) nItems = (end - ptr) / itemSize; return nItems; }
vuln
Safe
C/C++
static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, DECODER_BUFFER_DESC *bs, DECODER_BUFFER_DESC *sc) { const H264Context *h = avctx->priv_data; const unsigned mb_count = h->mb_width * h->mb_height; AVD...
vuln
Safe
C/C++
static void write_version( FILE *fp, const char *fname, const char *dirname, xref_t *xref) { long start; char *c, *new_fname, data; FILE *new_fp; start = ftell(fp); /* Create file */ if ((c = strstr(fname, ".pdf"))) *c = '\0'; new_fname = safe_calloc(st...
vuln
Safe
Unknown
public List<String> buildOpToNameList() throws HiddenAPIsError { Integer opNum = getNumOps(); if (opNum == null) { return null; } List<String> appOpsList = new ArrayList<>(); boolean failed = false; for (int i = 0; i < opNum; i++) { if (failed) { appOpsList.add("UNKNOWN"); ...
vuln
Safe
Java
PackLinuxElf32::check_pt_dynamic(Elf32_Phdr const *const phdr) { unsigned t = get_te32(&phdr->p_offset), s = sizeof(Elf32_Dyn) + t; unsigned filesz = get_te32(&phdr->p_filesz), memsz = get_te32(&phdr->p_memsz); if (s < t || file_size < (off_t)s || (3 & t) || (7 & (filesz | memsz)) // .balign 4; 8==siz...
vuln
Vulnerable
Unknown
void RenderProcessHostImpl::CreateSharedRendererHistogramAllocator() { if (!base::GlobalHistogramAllocator::Get()) { if (is_initialized_) { HistogramController::GetInstance()->SetHistogramMemory<RenderProcessHost>( this, mojo::ScopedSharedBufferHandle()); } return; } base::ProcessHand...
vuln
Vulnerable
C/C++
# -*- coding: utf-8 -*- # rdiffweb, A web interface to rdiff-backup repositories # Copyright (C) 2012-2021 rdiffweb contributors # # 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 Foundation, either version ...
vuln
Vulnerable
Python
static void io_req_drop_files(struct io_kiocb *req) { struct io_ring_ctx *ctx = req->ctx; unsigned long flags; spin_lock_irqsave(&ctx->inflight_lock, flags); list_del(&req->inflight_entry); if (waitqueue_active(&ctx->inflight_wait)) wake_up(&ctx->inflight_wait); spin_unlock_irqrestore(&ctx->inflight_lock, flag...
vuln
Vulnerable
Unknown
size_t IOBuf::goodExtBufferSize(std::size_t minCapacity) { // Determine how much space we should allocate. We'll store the SharedInfo // for the external buffer just after the buffer itself. (We store it just // after the buffer rather than just before so that the code can still just // use free(buf_) to free...
vuln
Vulnerable
Unknown
static void entropy_available(void *opaque) { RndRandom *s = RNG_RANDOM(opaque); uint8_t buffer[s->size]; ssize_t len; len = read(s->fd, buffer, s->size); if (len < 0 && errno == EAGAIN) { return; } g_assert(len != -1); s->receive_func(s->opaque, buffer, len); s->receive_fu...
vuln
Vulnerable
Unknown
static void vmxnet3_process_tx_queue(VMXNET3State *s, int qidx) { struct Vmxnet3_TxDesc txd; uint32_t txd_idx; uint32_t data_len; hwaddr data_pa; for (;;) { if (!vmxnet3_pop_next_tx_descr(s, qidx, &txd, &txd_idx)) { break; } vmxnet3_dump_tx_descr(&txd); ...
vuln
Vulnerable
Unknown
copyin_link(struct cpio_file_stat *file_hdr, int in_file_des) { char *link_name = NULL; /* Name of hard and symbolic links. */ int res; /* Result of various function calls. */ if (archive_format != arf_tar && archive_format != arf_ustar) { if (to_stdout_option) { tape_toss_input (...
vuln
Vulnerable
Unknown
static void virgl_cmd_resource_flush(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_resource_flush rf; int i; VIRTIO_GPU_FILL_CMD(rf); trace_virtio_gpu_cmd_res_flush(rf.resource_id, rf.r.width, rf.r.height, ...
vuln
Safe
Unknown
static void ivshmem_common_realize(PCIDevice *dev, Error **errp) { IVShmemState *s = IVSHMEM_COMMON(dev); Error *err = NULL; uint8_t *pci_conf; uint8_t attr = PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_PREFETCH; Error *local_err = NULL; if (ivshmem_has_feature(s, IVSHMEM_I...
vuln
Vulnerable
C/C++
xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) { int total = 0; int equal, ret; xmlXPathCompExprPtr comp; xmlXPathObjectPtr arg1, arg2; xmlNodePtr bak; xmlDocPtr bakd; int pp; int cs; CHECK_ERROR0; comp = ctxt->comp; switch (op->op) { case XP...
vuln
Safe
Unknown
private void printLiveRef(RemoteObjectWrapper ref) { if(ref == null) return; Logger.print(" "); Logger.printPlainMixedBlue("Endpoint:", ref.getTarget()); Logger.printlnPlainMixedBlue(" ObjID:", ref.objID.toString()); }
vuln
Vulnerable
Java
CopyFrom(CopyState cstate) { HeapTuple tuple; TupleDesc tupDesc; Datum *values; bool *nulls; ResultRelInfo *resultRelInfo; EState *estate = CreateExecutorState(); /* for ExecConstraints() */ ExprContext *econtext; TupleTableSlot *myslot; MemoryContext oldcontext = CurrentMemoryContext; ErrorContextC...
vuln
Safe
Unknown
def self.get_copies_folder(user_id) my_folder = User.get_my_folder(user_id) unless my_folder.nil? folder_name_quot = SqlHelper.quote(Item.copies_folder) con = "(parent_id=#{my_folder.id}) and (name=#{folder_name_quot})" begin copies_folder = Folder.where(con).first rescue ...
vuln
Safe
Ruby
public static int getColor(ItemStack stack, int tintIndex) { return tintIndex == 1 ? ((CustomHoneyBucketItem) stack.getItem()).getHoneyBucketColor() : BeeConstants.DEFAULT_ITEM_COLOR; }
vuln
Vulnerable
Java
void sendBootCompleted(IIntentReceiver resultTo) { final boolean systemUserFinishedBooting; // Get a copy of mStartedUsers to use outside of lock SparseArray<UserState> startedUsers; synchronized (mLock) { systemUserFinishedBooting = mCurrentUserId != UserHandle.USER_SYSTEM;...
vuln
Vulnerable
Java
def replace_flag_at_index(file_content): file_content = io.StringIO(file_content) content = list(csv.reader(file_content)) header = content[0] flag_col_index = header.index("flag") content[flag_index][flag_col_index] = flag_option output = io.Strin...
vuln
Safe
Python
static int hevc_init(AVCodecParserContext *s) { HEVCContext *h = &((HEVCParseContext *)s->priv_data)->h; h->HEVClc = av_mallocz(sizeof(HEVCLocalContext)); h->skipped_bytes_pos_size = INT_MAX; return 0; }
vuln
Vulnerable
C/C++
T){var N=Graph.customFontElements[T];null!=N&&N.url!=E&&(N.elt.parentNode.removeChild(N.elt),N=null);null==N?(N=E,"http:"==E.substring(0,5)&&(N=PROXY_URL+"?url="+encodeURIComponent(E)),N={name:u,url:E,elt:Graph.createFontElement(u,N)},Graph.customFontElements[T]=N,Graph.recentCustomFonts[T]=N,E=document.getElementsByTa...
vuln
Vulnerable
JavaScript
NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Extension, PIRP Irp) { PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation (Irp); NTSTATUS ntStatus; switch (irpSp->Parameters.DeviceIoControl.IoControlCode) { case TC_IOCTL_GET_DRIVER_VERSION: case TC_IOCTL_LEGACY_GET_DRIVER_VERSI...
vuln
Vulnerable
Unknown
static jas_image_cmpt_t *jas_image_cmpt_create(int_fast32_t tlx, int_fast32_t tly, int_fast32_t hstep, int_fast32_t vstep, int_fast32_t width, int_fast32_t height, uint_fast16_t depth, bool sgnd, uint_fast32_t inmem) { jas_image_cmpt_t *cmpt; size_t size; cmpt = 0; if (width < 0 || height < 0 || hstep <= 0 |...
vuln
Vulnerable
C/C++
private void handleServerMetadataRequest(final RoutingContext routingContext) { handleOldApiRequest(server, routingContext, null, Optional.empty(), (request, apiSecurityContext) -> endpoints.executeServerMetadata( DefaultApiSecurityContext.create(routingContext, server)) ); ...
vuln
Safe
Java
import ast import datetime import re import secrets import time from datetime import timedelta from typing import ( AbstractSet, Any, Callable, Dict, List, Optional, Sequence, Set, Tuple, TypeVar, Union, ) import django.contrib.auth from bitfield import BitField from bitfiel...
vuln
Vulnerable
Python
public int getInsertThrottleThresholdInPercentage() { return ((Long) this.parameterMap.getOrDefault( INSERT_THROTTLE_THRESHOLD_IN_PERCENTAGE_MAP_KEY, INSERT_THROTTLE_THRESHOLD_IN_PERCENTAGE_DEFAULT)) .intValue(); }
vuln
Vulnerable
Java
bool extract_sockaddr(char *url, char **sockaddr_url, char **sockaddr_port) { char *url_begin, *url_end, *ipv6_begin, *ipv6_end, *port_start = NULL; char url_address[256], port[6]; int url_len, port_len = 0; *sockaddr_url = url; url_begin = strstr(url, "//"); if (!url_begin) url_begin = url; else url_begin ...
vuln
Safe
C/C++
protected boolean checkKeyIntent(int authUid, Bundle bundle) { if (!checkKeyIntentParceledCorrectly(bundle)) { EventLog.writeEvent(0x534e4554, "250588548", authUid, ""); return false; } Intent intent = bundle.getParcelable(AccountManager.KEY_INTENT); ...
vuln
Safe
Java
#!/usr/bin/env python2 # vim:fileencoding=utf-8 from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>' import cPickle from PyQt5.Qt import ( Qt, QListWidget, QListWidgetItem,...
vuln
Vulnerable
Python
/* NetHack 3.6 topten.c $NHDT-Date: 1450451497 2015/12/18 15:11:37 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.44 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ #inclu...
vuln
Safe
C/C++
public void updateConfig(int rate) { if(rate != 8000 && rate != 12000 && rate != 24000 && rate != 48000) { VoiceClient.LOGGER.info("Incorrect sample rate"); return; } if(this.thread != null) { this.running = false; synchronized (this) { ...
vuln
Vulnerable
Java
// mkerrors.sh // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- _const.go package unix import "syscall" const ( AF_APPLETALK = 0x10 AF_ARP = 0x23 AF_ATM ...
vuln
Safe
Go
static struct sk_buff **gre_gro_receive(struct sk_buff **head, struct sk_buff *skb) { struct sk_buff **pp = NULL; struct sk_buff *p; const struct gre_base_hdr *greh; unsigned int hlen, grehlen; unsigned int off; int flush = 1; struct packet_offload *ptype; __be16 type; if (NAPI_GRO_CB(skb)->encap_mark...
vuln
Safe
C/C++
imap_auth_res_t imap_auth_cram_md5 (IMAP_DATA* idata, const char* method) { char ibuf[LONG_STRING*2], obuf[LONG_STRING]; unsigned char hmac_response[MD5_DIGEST_LEN]; int len; int rc; if (!mutt_bit_isset (idata->capabilities, ACRAM_MD5)) return IMAP_AUTH_UNAVAIL; mutt_message _("Authenticating (CRAM-MD...
vuln
Safe
Unknown
static int check_exception(int intno, int *error_code) { int first_contributory = env->old_exception == 0 || (env->old_exception >= 10 && env->old_exception <= 13); int second_contributory = intno == 0 || (intno >= 10 &&...
vuln
Safe
C/C++
xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ xmlXPathObjectPtr obj1, obj2; if (nargs != 2) { xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, "key() : expects two arguments\n"); ctxt->error = XPATH_INVALID_ARITY; return; } /* * Get the key's value. */ o...
vuln
Vulnerable
C/C++
rsa_oaep_sha256_decrypt(const struct rsa_private_key *key, size_t label_length, const uint8_t *label, size_t *length, uint8_t *message, const mpz_t gibberish) { mpz_t m; int res; struct sha256_ctx ctx; mpz_init(m); rsa_compute_root(key, m, gibberish); res = pkcs1_oaep_decrypt (key->size, m,...
vuln
Vulnerable
Unknown
def handle(self, command, kwargs=None): """ Dispatch and handle processing of the given command. :param command: Name of command to run. :type command: unicode :param kwargs: Arguments to pass to the command handler. If empty, `request.POST` is used. :type kwargs: dict ...
vuln
Vulnerable
Python
/* * Copyright 2021 ThoughtWorks, Inc. * * 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 agr...
vuln
Safe
Java
PHP_FUNCTION(openssl_seal) { zval *pubkeys, *pubkey, *sealdata, *ekeys, *iv = NULL; HashTable *pubkeysht; EVP_PKEY **pkeys; zend_resource ** key_resources; /* so we know what to cleanup */ int i, len1, len2, *eksl, nkeys, iv_len; unsigned char iv_buf[EVP_MAX_IV_LENGTH + 1], *buf = NULL, **eks; char * data; size...
vuln
Safe
C/C++
static int Downmix_Command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t *replySize, void *pReplyData) { downmix_module_t *pDwmModule = (downmix_module_t *) self; downmix_object_t *pDownmixer; int retsize; if (pDwmModule == NULL || pDwmModule->context.state == DOWNMIX_STATE_U...
vuln
Vulnerable
C/C++
static inline void gen_st8(TCGv val, TCGv addr, int index) { tcg_gen_qemu_st8(val, addr, index); tcg_temp_free_i32(val); }
vuln
Safe
C/C++
/** * <a href="http://www.openolat.org"> * OpenOLAT - Online Learning and Training</a><br> * <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 the * <a href="http://www.apache...
vuln
Vulnerable
Java
def self.loginByPassword(session, username, password) if validUser(username, password) session[:username] = username success, groups = getUsersGroups(username) session[:usergroups] = success ? groups : [] return true end return false end
vuln
Vulnerable
Ruby
static int stellaris_enet_init(SysBusDevice *sbd) { DeviceState *dev = DEVICE(sbd); stellaris_enet_state *s = STELLARIS_ENET(dev); memory_region_init_io(&s->mmio, OBJECT(s), &stellaris_enet_ops, s, "stellaris_enet", 0x1000); sysbus_init_mmio(sbd, &s->mmio); sysbus_init_irq...
vuln
Vulnerable
Unknown
static ssize_t autosuspend_delay_ms_show(struct device *dev, struct device_attribute *attr, char *buf) { if (!dev->power.use_autosuspend) return -EIO; return sprintf(buf, "%d\n", dev->power.autosuspend_delay); }
vuln
Vulnerable
Unknown
static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { struct v4l2_loopback_device *dev = v4l2loopback_getdevice(file); int labellen = (sizeof(cap->card) < sizeof(dev->card_label)) ? sizeof(cap->card) : sizeof(dev->card_label); int device_nr = ((struct v4l...
vuln
Vulnerable
C/C++
static int webm_dash_manifest_write_header(AVFormatContext *s) { int i; double start = 0.0; int ret; WebMDashMuxContext *w = s->priv_data; ret = parse_adaptation_sets(s); if (ret < 0) { free_adaptation_sets(s); return ret; } write_header(s); avio_printf(s->pb, "<Perio...
vuln
Safe
C/C++
static void Cmd_TokenizeString2( const char *text_in, qboolean ignoreQuotes ) { const char *text; char *textOut; #ifdef TKN_DBG // FIXME TTimo blunt hook to try to find the tokenization of userinfo Com_DPrintf("Cmd_TokenizeString: %s\n", text_in); #endif // clear previous args cmd_argc = 0; if ( !text_in ) ...
vuln
Safe
C/C++
RefCountedMemory* ChromeWebUIControllerFactory::GetFaviconResourceBytes( const GURL& page_url) const { if (page_url.host() == extension_misc::kBookmarkManagerId) return BookmarksUI::GetFaviconResourceBytes(); if (page_url.SchemeIs(chrome::kExtensionScheme)) { NOTREACHED(); return NULL; } if...
vuln
Vulnerable
C/C++
static int expandrow(UINT8* dest, UINT8* src, int n, int z, int xsize) { UINT8 pixel, count; int x = 0; for (;n > 0; n--) { pixel = *src++; if (n == 1 && pixel != 0) return n; count = pixel & RLE_MAX_RUN; if (!count) return count; if (x + ...
vuln
Safe
C/C++
static Image *ReadXPMImage(const ImageInfo *image_info,ExceptionInfo *exception) { char *grey, key[MaxTextExtent], target[MaxTextExtent], *xpm_buffer; Image *image; MagickBooleanType active, status; register char *next, *p, *q; register IndexPacket *indexes; ...
vuln
Vulnerable
C/C++
int ff_h264_fill_default_ref_list(H264Context *h) { int i, len; if (h->slice_type_nos == AV_PICTURE_TYPE_B) { Picture *sorted[32]; int cur_poc, list; int lens[2]; if (FIELD_PICTURE(h)) cur_poc = h->cur_pic_ptr->field_poc[h->picture_structure == PICT_BOTTOM_FIELD]; ...
vuln
Safe
C/C++
h2_end_headers(struct worker *wrk, struct h2_sess *h2, struct req *req, struct h2_req *r2) { h2_error h2e; ASSERT_RXTHR(h2); assert(r2->state == H2_S_OPEN); h2e = h2h_decode_fini(h2); h2->new_req = NULL; if (h2e != NULL) { Lck_Lock(&h2->sess->mtx); VSLb(h2->vsl, SLT_Debug, "HPACK/FINI %s", h2e->name); ...
vuln
Vulnerable
Unknown
/* * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2002-2016, Open Source Geospatial Foundation (OSGeo) * * This library 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 ...
vuln
Safe
Java
header_cache_t* imap_hcache_open (IMAP_DATA* idata, const char* path) { IMAP_MBOX mx; ciss_url_t url; char cachepath[LONG_STRING]; char mbox[LONG_STRING]; size_t len; if (path) imap_cachepath (idata, path, mbox, sizeof (mbox)); else { if (!idata->ctx || imap_parse_path (idata->ctx->path, &mx) <...
vuln
Safe
C/C++
static void virtio_balloon_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); dc->props = virtio_balloon_properties; set_bit(DEVICE_CATEGORY_MISC, dc->categories); vdc->init = virtio_balloon_device_init; vdc->e...
vuln
Safe
C/C++
undo_time( long step, int sec, int file, int absolute) { long target; long closest; long closest_start; long closest_seq = 0; long val; u_header_T *uhp = NULL; u_header_T *last; int mark; int nomark = 0; // shut up compiler ...
vuln
Safe
Unknown
public float totalProductionIncome() { if (inRebellion()) return 0.1f; ensureProperSpendingRates(); float prod = production(); float reserveCost = prod * colonyTaxPct(); float securityCost = prod * empire.totalSecurityCostPct(); float shipCost...
vuln
Safe
Java
static int llcp_sock_create(struct net *net, struct socket *sock, const struct nfc_protocol *nfc_proto, int kern) { struct sock *sk; pr_debug("%p\n", sock); if (sock->type != SOCK_STREAM && sock->type != SOCK_DGRAM && sock->type != SOCK_RAW) return -ESOCKTNOSUPPORT; if (sock->type == SOCK_RAW)...
vuln
Safe
Unknown