code stringlengths 10 33.4M | task stringclasses 2
values | label stringclasses 121
values | language stringclasses 13
values |
|---|---|---|---|
static ssize_t wdm_read
(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
{
int rv, cntr;
int i = 0;
struct wdm_device *desc = file->private_data;
rv = mutex_lock_interruptible(&desc->rlock); /*concurrent reads */
if (rv < 0)
return -ERESTARTSYS;
cntr = ACCESS_ONCE(desc->length);
if (cntr... | vuln | Vulnerable | C/C++ |
// This file is part of Deark.
// Copyright (C) 2016 Jason Summers
// See the file COPYING for terms of use.
// This file is for format-specific functions that are used by multiple modules.
#define DE_NOT_IN_MODULE
#include "deark-config.h"
#include "deark-private.h"
#include "deark-fmtutil.h"
void fmtutil_get_bmp_c... | cwe | CWE-369 | C/C++ |
/*
* Copyright 2018 Red Hat, 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 agreed to ... | cwe | CWE-863 | Java |
ReverbConvolverStage::ReverbConvolverStage(const float* impulseResponse, size_t, size_t reverbTotalLatency, size_t stageOffset, size_t stageLength,
size_t fftSize, size_t renderPhase, size_t renderSliceSize, ReverbAccumulationBuffer* accumulationBuffer, bool directMode)
: ... | vuln | Vulnerable | C/C++ |
export function loadEmailAddressesAndLoginMethods(userId: UserId, success: UserAcctRespHandler) {
get(`/-/load-email-addrs-login-methods?userId=${userId}`, response => {
success(response);
});
} | cwe | CWE-613 | Scala |
@Override
public void update() {
super.update();
world.beginProfiling("EntityG_Level", true);
if (!world.isClient()) {
//Do validity checks for towing variables. We could do this whenever we disconnect,
//but there are tons of ways this could happen. The trailer cou... | vuln | Vulnerable | Java |
int extract_status_code(char *buffer, size_t size)
{
char *buf_code;
char *begin;
char *end = buffer + size;
size_t inc = 0;
int code;
/* Allocate the room */
buf_code = (char *)MALLOC(10);
/* Status-Code extraction */
while (buffer < end && *buffer++ != ' ') ;
begin = buffer;
while (buffer < end && *bu... | cwe | CWE-119 | C/C++ |
const {
getGlobalDB,
getTenantId,
isUserInAppTenant,
} = require("@budibase/backend-core/tenancy")
const { generateDevInfoID, SEPARATOR } = require("@budibase/backend-core/db")
const { user: userCache } = require("@budibase/backend-core/cache")
const {
hash,
platformLogout,
getCookie,
clearCookie,
} = req... | cwe | CWE-284 | JavaScript |
/*
* 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,... | cwe | CWE-287 | Java |
static void qtrle_decode_1bpp(QtrleContext *s, int stream_ptr, int row_ptr, int lines_to_change)
{
int rle_code;
int pixel_ptr = 0;
int row_inc = s->frame.linesize[0];
unsigned char pi0, pi1;
unsigned char *rgb = s->frame.data[0];
int pixel_limit = s->frame.linesize[0] * s->avctx->height;
... | vuln | Vulnerable | C/C++ |
static void http_manage_server_side_cookies(struct stream *s, struct channel *res)
{
struct session *sess = s->sess;
struct http_txn *txn = s->txn;
struct htx *htx;
struct http_hdr_ctx ctx;
struct server *srv;
char *hdr_beg, *hdr_end;
char *prev, *att_beg, *att_end, *equal, *val_beg, *val_end, *next;
int is_coo... | vuln | Safe | C/C++ |
static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id)
{
struct trace_array *tr = data;
struct ftrace_event_file *ftrace_file;
struct syscall_trace_enter *entry;
struct syscall_metadata *sys_data;
struct ring_buffer_event *event;
struct ring_buffer *buffer;
unsigned long irq_flags;
int pc;
... | cwe | CWE-119 | Unknown |
/*
* Kexec bzImage loader
*
* Copyright (C) 2014 Red Hat Inc.
* Authors:
* Vivek Goyal <vgoyal@redhat.com>
*
* This source code is licensed under the GNU General Public License,
* Version 2. See the file COPYING for more details.
*/
#define pr_fmt(fmt) "kexec-bzImage64: " fmt
#include <linux/string.h>
... | cwe | CWE-254 | C/C++ |
_forceinline void Unpack::CopyString(uint Length,uint Distance)
{
size_t SrcPtr=UnpPtr-Distance;
if (SrcPtr<MaxWinSize-MAX_LZ_MATCH && UnpPtr<MaxWinSize-MAX_LZ_MATCH)
{
// If we are not close to end of window, we do not need to waste time
// to "& MaxWinMask" pointer protection.
byte *Src=Window+SrcP... | vuln | Vulnerable | C/C++ |
void CL_Init( void ) {
Com_Printf( "----- Client Initialization -----\n" );
Con_Init ();
if(!com_fullyInitialized)
{
CL_ClearState();
clc.state = CA_DISCONNECTED; // no longer CA_UNINITIALIZED
cl_oldGameSet = qfalse;
}
cls.realtime = 0;
CL_InitInput ();
//
// register our variables
//
cl_noprint =... | cwe | CWE-269 | Unknown |
static RList *symbols(RBinFile *bf) {
RList *res = r_list_newf ((RListFree)r_bin_symbol_free);
r_return_val_if_fail (res && bf->o && bf->o->bin_obj, res);
RCoreSymCacheElement *element = bf->o->bin_obj;
size_t i;
HtUU *hash = ht_uu_new0 ();
if (!hash) {
return res;
}
bool found = false;
for (i = 0; i < eleme... | cwe | CWE-787 | C/C++ |
static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
{
DNXHDContext *ctx = avctx->priv_data;
ctx->avctx = avctx;
ctx->cid = -1;
if (avctx->colorspace == AVCOL_SPC_UNSPECIFIED) {
avctx->colorspace = AVCOL_SPC_BT709;
}
avctx->coded_width = FFALIGN(avctx->width, 16);
avctx->cod... | vuln | Safe | C/C++ |
@Override
public void runAtStart() throws Exception {
try {
pluginsConfig = new PluginsConfig();
} catch (DuplicateKeyException e) {
getWarnings().add(new BetterWarning(this, e, "Duplicate plugin (or plugin name from its plugin.yml) found in your plugins directory. " +
... | vuln | Safe | Java |
static int string_scan_range(RList *list, const ut8 *buf, int min,
const ut64 from, const ut64 to, int type) {
ut8 tmp[R_STRING_SCAN_BUFFER_SIZE];
ut64 str_start, needle = from;
int count = 0, i, rc, runes;
int str_type = R_STRING_TYPE_DETECT;
if (type == -1) {
type = R_STRING_TYPE_DETECT;
}
if (!buf... | cwe | CWE-125 | Unknown |
int ocfs2_set_acl(handle_t *handle,
struct inode *inode,
struct buffer_head *di_bh,
int type,
struct posix_acl *acl,
struct ocfs2_alloc_context *meta_ac,
struct ocfs2_alloc_context *data_ac)
{
int name_index;
void *value = NULL;
size_t size = 0;
int ret;
if (S_ISLNK(inode->i_mode))
retur... | cwe | CWE-285 | Unknown |
/*
* FreeRTOS Kernel V10.4.2
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* 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, includ... | vuln | Vulnerable | C/C++ |
#!/usr/bin/env python
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from datetime import datetime
from typing import Any, Dict, Generic, List, Optional, Tuple, TypeVar, Union
from uuid import UUID, uuid4
from pydantic import BaseModel, Field, root_validator, validator
from pydantic.datacl... | vuln | Vulnerable | Python |
export function escapeCommentText(value: string): string {
return value.replace(END_COMMENT, END_COMMENT_ESCAPED);
} | cwe | CWE-79 | JavaScript |
static int fuse_ioctl_copy_user(struct page **pages, struct iovec *iov,
unsigned int nr_segs, size_t bytes, bool to_user)
{
struct iov_iter ii;
int page_idx = 0;
if (!bytes)
return 0;
iov_iter_init(&ii, iov, nr_segs, bytes, 0);
while (iov_iter_count(&ii)) {
struct page *page = pages[page_idx++];
size_t... | vuln | Safe | Unknown |
ex_substitute(exarg_T *eap)
{
linenr_T lnum;
long i = 0;
regmmatch_T regmatch;
static subflags_T subflags = {FALSE, FALSE, FALSE, TRUE, FALSE,
FALSE, FALSE, 0};
#ifdef FEAT_EVAL
subflags_T subflags_save;
#endif
int save_do_all; // remember user specified 'g' flag
int save_do_... | vuln | Vulnerable | Unknown |
function send_reset_confirmation_request($name)
{
global $sitename;
$rs = safe_row("email, nonce", 'txp_users', "name = '".doSlash($name)."'");
if ($rs) {
extract($rs);
$confirm = bin2hex(pack('H*', substr(md5($nonce), 0, 10)).$name);
$message = gTxt('greeting').' '.$name.','.
... | cwe | CWE-521 | PHP |
void bn_srt(bn_t c, bn_t a) {
bn_t h, l, m, t;
int bits, cmp;
if (bn_sign(a) == RLC_NEG) {
RLC_THROW(ERR_NO_VALID);
}
bits = bn_bits(a);
bits += (bits % 2);
bn_null(h);
bn_null(l);
bn_null(m);
bn_null(t);
RLC_TRY {
bn_new(h);
bn_new(l);
bn_new(m);
bn_new(t);
bn_set_2b(h, bits >> 1);
bn_set... | vuln | Vulnerable | C/C++ |
lspci_process(STREAM s)
{
unsigned int pkglen;
static char *rest = NULL;
char *buf;
pkglen = s->end - s->p;
/* str_handle_lines requires null terminated strings */
buf = xmalloc(pkglen + 1);
STRNCPY(buf, (char *) s->p, pkglen + 1);
#if 0
printf("lspci recv:\n");
hexdump(s->p, pkglen);
#endif
str_handle_line... | cwe | CWE-787 | Unknown |
lrmd_remote_listen(gpointer data)
{
int csock = 0;
int flag = 0;
unsigned laddr = 0;
struct sockaddr addr;
gnutls_session_t *session = NULL;
crm_client_t *new_client = NULL;
static struct mainloop_fd_callbacks lrmd_remote_fd_cb = {
.dispatch = lrmd_remote_client_msg,
.destro... | cwe | CWE-254 | C/C++ |
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% ... | cwe | CWE-399 | C/C++ |
/*
* 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... | cwe | CWE-787 | C/C++ |
ext4_xattr_cache_insert(struct mb2_cache *ext4_mb_cache, struct buffer_head *bh)
{
__u32 hash = le32_to_cpu(BHDR(bh)->h_hash);
int error;
error = mb2_cache_entry_create(ext4_mb_cache, GFP_NOFS, hash,
bh->b_blocknr);
if (error) {
if (error == -EBUSY)
ea_bdebug(bh, "already in cache");
} else
ea_b... | vuln | Safe | C/C++ |
@Override
public void interrupt() {
mediaPlayer.release();
super.interrupt();
} | vuln | Vulnerable | Java |
static v8::Handle<v8::Value> getNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
if (!htmlDocument->hasNamedItem(key.impl()) && !htmlDocument->hasExtraNamedItem(key.impl()))
return v8Undefined();
RefPtr<HTMLCollection... | cwe | CWE-399 | C/C++ |
@Override
protected void service(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException {
if (rewriteConfig == null) {
configure();
rewriteConfig = new RewriteConfig(this);
}
final long start = System.currentTimeMil... | vuln | Vulnerable | Java |
parse_wbxml_attribute_list_defined (proto_tree *tree, tvbuff_t *tvb,
guint32 offset, guint32 str_tbl, guint8 level, guint8 *codepage_attr,
const wbxml_decoding *map)
{
guint32 tvb_len = tvb_reported_length (tvb);
guint32 off = offset;
guint32 len;
guint str_len;
guint32 ... | cwe | CWE-399 | C/C++ |
"""
File: /lib/cogs/website.py
Info: This cog handles the website which talks to the API.
"""
from datetime import datetime
from math import prod
import nextcord
from nextcord.ext.commands import Cog, command
from nextcord.ext.commands.core import Command
from nextcord import Embed, Colour, colour
from quart im... | cwe | CWE-116 | Python |
private static Optional<IdentityProviderModel> discoverHomeIdp(
AuthenticationFlowContext context, String domain, UserModel user, String username) {
final Map<String, String> linkedIdps;
HomeIdpDiscoveryConfig config = new HomeIdpDiscoveryConfig(context.getAuthenticatorConfig());
if (user == null || ... | vuln | Safe | Java |
static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception)
{
const char
*option;
Image
*image;
int
jp2_status;
MagickBooleanType
status;
opj_codec_t
*jp2_codec;
opj_codestream_index_t
*codestream_index = (opj_codestream_index_t *) NULL;
opj_dparameters_t... | vuln | Vulnerable | C/C++ |
default boolean sameAs(Notification.MessagingStyle.Message message) {
Notification.MessagingStyle.Message ownMessage = getMessage();
if (!Objects.equals(message.getText(), ownMessage.getText())) {
return false;
}
if (!Objects.equals(message.getSender(), ownMessage.getSender()... | vuln | Vulnerable | Java |
e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt,
const E1000E_RxRing *rxr,
const E1000E_RSSInfo *rss_info)
{
PCIDevice *d = core->owner;
dma_addr_t base;
uint8_t desc[E1000_MAX_RX_DESC_LEN];
size_t desc_size;
size_t desc_o... | cwe | CWE-835 | C/C++ |
function PMA_getErrorReportForm()
{
$html = "";
$html .= '<form action="error_report.php" method="post" name="report_frm"'
. ' id="report_frm" class="ajax">'
. '<fieldset style="padding-top:0px">';
$html .= '<p>' . __(
'phpMyAdmin has encountered an error. We have collected ... | cwe | CWE-79 | PHP |
# Copyright 2017 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 applica... | cwe | CWE-94 | C/C++ |
GIT_INLINE(bool) verify_dotgit_ntfs(git_repository *repo, const char *path, size_t len)
{
git_buf *reserved = git_repository__reserved_names_win32;
size_t reserved_len = git_repository__reserved_names_win32_len;
size_t start = 0, i;
if (repo)
git_repository__reserved_names(&reserved, &reserved_len, repo, true);
... | vuln | Vulnerable | C/C++ |
public RuntimeException throwOriginalException(BinaryMarshaller<? extends Throwable> marshaller) {
try {
BinaryInput in = BinaryInput.create(rawData);
Throwable t = marshaller.read(in);
throw ForeignException.silenceException(RuntimeException.class, t);
} finally {
... | vuln | Vulnerable | Java |
fgetwln(FILE *stream, size_t *lenp)
{
struct filewbuf *fb;
wint_t wc;
size_t wused = 0;
/* Try to diminish the possibility of several fgetwln() calls being
* used on different streams, by using a pool of buffers per file. */
fb = &fb_pool[fb_pool_cur];
if (fb->fp != stream && fb->fp != NULL) {
fb_pool_cur++;... | vuln | Safe | C/C++ |
@Override
public boolean shouldListen(ServerLevel pLevel, GameEventListener pListener, BlockPos pPos, GameEvent pEvent, GameEvent.Context pContext) {
if (!this.isDeadOrDying() && level.getWorldBorder().isWithinBounds(pPos) && !this.isRemoved() && this.level == level) {
Entity entity = pContext.s... | vuln | Safe | Java |
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <stdint.h>
#ifndef JSI_AMALGAMATION
#include "jsiInt.h"
#endif
#define REBUILD_MULTIPLIER 3
#if JSI_IS64BIT
#define RANDOM_INDEX HashOneWord
#define DOWNSHIFT_START 62
#else
#define RANDOM_INDEX(tablePtr, i) \
(((... | vuln | Safe | C/C++ |
int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
{
size_t i;
struct agp_bridge_data *bridge;
int mask_type;
bridge = mem->bridge;
if (!bridge)
return -EINVAL;
if (mem->page_count == 0)
return 0;
if (type != mem->type)
return -EINVAL;
mask_type = bridge->driver->agp_type_... | cwe | CWE-190 | Unknown |
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)... | vuln | Vulnerable | Unknown |
lyd_dup_to_ctx(const struct lyd_node *node, int options, struct ly_ctx *ctx)
{
struct ly_ctx *log_ctx;
struct lys_node_list *slist;
struct lys_node *schema;
const char *yang_data_name;
const struct lys_module *trg_mod;
const struct lyd_node *next, *elem;
struct lyd_node *ret, *parent, *key, ... | vuln | Safe | Unknown |
GPMF_ERR IsValidSize(GPMF_stream *ms, uint32_t size) // size is in longs not bytes.
{
if (ms)
{
int32_t nestsize = (int32_t)ms->nest_size[ms->nest_level];
if (nestsize == 0 && ms->nest_level == 0)
nestsize = ms->buffer_size_longs;
if (size + 2 <= nestsize) return GPMF_OK;
}
return GPMF_ERROR_BAD_STRUCTURE... | cwe | CWE-125 | Unknown |
static int
pkcs11_fetch_x509_pubkey(struct pkcs11_provider *p, CK_ULONG slotidx,
CK_OBJECT_HANDLE *obj, struct sshkey **keyp, char **labelp)
{
CK_ATTRIBUTE cert_attr[3];
CK_SESSION_HANDLE session;
CK_FUNCTION_LIST *f = NULL;
CK_RV rv;
X509 *x509 = NULL;
X509_NAME *x509_name = NULL;
EVP_PKEY *evp;
... | vuln | Vulnerable | C/C++ |
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2019 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute i... | cwe | CWE-79 | JavaScript |
int flb_parser_json_do(struct flb_parser *parser,
const char *in_buf, size_t in_size,
void **out_buf, size_t *out_size,
struct flb_time *out_time)
{
int i;
int skip;
int ret;
int slen;
int root_type;
int records;
double tmf... | cwe | CWE-415 | C/C++ |
znumicc_components(i_ctx_t * i_ctx_p)
{
ref * pnval;
ref * pstrmval;
stream * s;
int ncomps, expected = 0, code;
cmm_profile_t *picc_profile;
os_ptr op = osp;
check_type(*op, t_dictionary);
... | cwe | CWE-704 | Unknown |
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#include "checkout.h"
#include "git2/repository.h"
#include "git2/refs.h"
#include "git2/tree.h"
#inclu... | cwe | CWE-20 | C/C++ |
/*
* 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... | cwe | CWE-674 | C/C++ |
/*
Ming, an SWF output library
Copyright (C) 2002 Opaque Industries - http://www.opaque.net/
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 Software Foundation; either
version 2.1 of the ... | cwe | CWE-20 | C/C++ |
/*
Copyright 2017 The Kubernetes Authors.
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 in writing, ... | cwe | CWE-863 | Go |
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014-2019 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
* Website: https://www.espocrm.com
*
* EspoCRM is free software: you can redistribute i... | cwe | CWE-79 | JavaScript |
void writeBytes(const void* data, int length) {
check(length);
memcpy(ptr, data, length);
ptr += length;
} | cwe | CWE-787 | C/C++ |
int ff_pred_weight_table(H264Context *h)
{
int list, i;
int luma_def, chroma_def;
h->use_weight = 0;
h->use_weight_chroma = 0;
h->luma_log2_weight_denom = get_ue_golomb(&h->gb);
if (h->sps.chroma_format_idc)
h->chroma_log2_weight_denom = get_ue_golomb(&h->gb);
if (h-... | vuln | Safe | C/C++ |
void ExtensionWebContentsObserver::RenderViewCreated(
content::RenderViewHost* render_view_host) {
const Extension* extension = GetExtension(render_view_host);
if (!extension)
return;
content::RenderProcessHost* process = render_view_host->GetProcess();
if (type == Manifest::TYPE_EXTENSION ||
... | cwe | CWE-264 | C/C++ |
/*
* Copyright 2014-2021 the original author or authors.
*
* 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 app... | cwe | CWE-94 | Java |
def karma_add(name):
karma = karma_ask(name)
db = db_connect()
cursor = db.cursor()
if karma is None:
try:
cursor.execute('''
INSERT INTO people(name,karma,shame) VALUES('{}',1,0)
'''.format(name))
db.commit()
logger.debug('Inse... | cwe | CWE-89 | Python |
def parse_encoding(
ft: DictionaryObject, space_code: int
) -> Tuple[Union[str, Dict[int, str]], int]:
encoding: Union[str, List[str], Dict[int, str]] = []
if "/Encoding" not in ft:
try:
if "/BaseFont" in ft and cast(str, ft["/BaseFont"]) in charset_encoding:
encoding = d... | vuln | Vulnerable | Python |
int _gnutls_find_config_path(char *path, size_t max_size)
{
const char *home_dir = getenv("HOME");
if (home_dir != NULL && home_dir[0] != 0) {
snprintf(path, max_size, "%s/" CONFIG_PATH, home_dir);
return 0;
}
#ifdef _WIN32
if (home_dir == NULL || home_dir[0] == '\0') {
const char *home_drive = getenv("HOME... | cwe | CWE-20 | Unknown |
bool asn1_read_LDAPString(struct asn1_data *data, TALLOC_CTX *mem_ctx, char **s)
{
int len;
len = asn1_tag_remaining(data);
if (len < 0) {
data->has_error = true;
return false;
}
*s = talloc_array(mem_ctx, char, len+1);
if (! *s) {
data->has_error = true;
return false;
}
asn1_read(data, *s, len);
(*s)[... | cwe | CWE-399 | Unknown |
static inline Quantum GetPixelChannel(const Image *magick_restrict image,
const PixelChannel channel,const Quantum *magick_restrict pixel)
{
if (image->channel_map[channel].traits == UndefinedPixelTrait)
return((Quantum) 0);
return(pixel[image->channel_map[channel].offset]);
} | cwe | CWE-20 | C/C++ |
handle_keywordonly_args(struct compiling *c, const node *n, int start,
asdl_seq *kwonlyargs, asdl_seq *kwdefaults)
{
PyObject *argname;
node *ch;
expr_ty expression, annotation;
arg_ty arg;
int i = start;
int j = 0; /* index for kwdefaults and kwonlyargs */
if (kwonl... | cwe | CWE-125 | C/C++ |
from django.apps import AppConfig
class AnymailBaseConfig(AppConfig):
name = 'anymail'
verbose_name = "Anymail"
def ready(self):
pass
| cwe | CWE-532 | Python |
/* Unicorn Emulator Engine */
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2015 */
/* Modified for Unicorn Engine by Chen Huitao<chenhuitao@hfmrit.com>, 2020 */
#if defined(UNICORN_HAS_OSXKERNEL)
#include <libkern/libkern.h>
#else
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#endif
#include <time.h> // na... | cwe | CWE-401 | C/C++ |
@Method(0x801030d8L)
public static void FUN_801030d8(final int index, final ScriptState<EffectManagerData6c> state, final EffectManagerData6c data) {
final BttlScriptData6cSub38 s6 = (BttlScriptData6cSub38)data.effect_44;
if(s6._04.get() + 1 == s6._0c.get()) {
return;
}
final ShortRef sp0x20 =... | vuln | Safe | Java |
int nfc_data_exchange(struct nfc_dev *dev, u32 target_idx, struct sk_buff *skb,
data_exchange_cb_t cb, void *cb_context)
{
int rc;
pr_debug("dev_name=%s target_idx=%u skb->len=%u\n",
dev_name(&dev->dev), target_idx, skb->len);
device_lock(&dev->dev);
if (dev->shutting_down) {
rc = -ENODEV;
kfree_s... | vuln | Safe | Unknown |
bool FontData::Bound(int32_t offset) {
if (offset > Size() || offset < 0)
return false;
bound_offset_ += offset;
return true;
} | cwe | CWE-189 | C/C++ |
package com.salesmanager.core.business.utils;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Currency;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
... | cwe | CWE-639 | Java |
static void flush_encoders(void)
{
int i, ret;
for (i = 0; i < nb_output_streams; i++) {
OutputStream *ost = output_streams[i];
AVCodecContext *enc = ost->enc_ctx;
OutputFile *of = output_files[ost->file_index];
if (!ost->encoding_needed)
continue;
... | vuln | Safe | C/C++ |
strip_leading_slashes (char *name, int strip_leading)
{
int s = strip_leading;
char *p, *n;
for (p = n = name; *p; p++)
{
if (ISSLASH (*p))
{
while (ISSLASH (p[1]))
p++;
if (strip_leading < 0 || --s >= 0)
n = p+1;
}
}
if ((strip_leading < 0 || s <= 0) && *n)
{
memm... | vuln | Vulnerable | Unknown |
function updateLabel () {
try {
var thisId = jQuery('#fb-field-id').val();
var thisLabel = jQuery('#fb-new-label').val();
// Update preview
if (thisLabel.length === 0) {
jQuery('#fb-new-field' + thisId + ' label .label-text').html("New field");
} else {
jQuery('#fb-new-field' + thisId + ' label... | vuln | Vulnerable | JavaScript |
sdhci_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
{
SDHCIState *s = (SDHCIState *)opaque;
unsigned shift = 8 * (offset & 0x3);
uint32_t mask = ~(((1ULL << (size * 8)) - 1) << shift);
uint32_t value = val;
value <<= shift;
switch (offset & ~0x3) {
case SDHC_SYSAD:
... | cwe | CWE-119 | C/C++ |
GF_Err gf_isom_set_extraction_slc(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, const GF_SLConfig *slConfig)
{
GF_TrackBox *trak;
GF_SampleEntryBox *entry;
GF_Err e;
GF_SLConfig **slc;
trak = gf_isom_get_track_from_file(the_file, trackNumber);
if (!trak) return GF_BAD_PARAM;
e = Media_GetS... | cwe | CWE-476 | C/C++ |
void ide_atapi_cmd_reply_end(IDEState *s)
{
int byte_count_limit, size, ret;
while (s->packet_transfer_size > 0) {
trace_ide_atapi_cmd_reply_end(s, s->packet_transfer_size,
s->elementary_transfer_size,
s->io_buffer_index);
... | cwe | CWE-125 | C/C++ |
TfLiteStatus InitializeTemporaries(TfLiteContext* context, TfLiteNode* node,
OpContext* op_context) {
// Create temporary tensors to hold transposed LHS/RHS.
OpData* op_data = reinterpret_cast<OpData*>(node->user_data);
const TfLiteTensor* lhs = op_context->lhs;
const TfLiteTe... | vuln | Safe | C/C++ |
Status CalculateOutputIndex(OpKernelContext* context, int dimension,
const vector<INDEX_TYPE>& parent_output_index,
INDEX_TYPE output_index_multiplier,
INDEX_TYPE output_size,
vector<INDEX_TYPE>* resu... | vuln | Vulnerable | C/C++ |
def sign_up_page():
if request.method == 'POST':
username = request.form['username']
password = request.form['password']
hashed_password = pwd_context.encrypt(password)
email = request.form['email']
id = 1
with dbapi2.connect(current_app.config['dsn']) as connection:
cursor = connectio... | vuln | Vulnerable | Python |
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\... | cwe | CWE-119 | C/C++ |
protected function gdImageCreate($path,$mime){
switch($mime){
case 'image/jpeg':
return @imagecreatefromjpeg($path);
case 'image/png':
return @imagecreatefrompng($path);
case 'image/gif':
return @imagecreatefromgif($path);
case 'image/x-ms-bmp':
if (!function_exists('imagecreatefrombmp')) {... | cwe | CWE-89 | JavaScript |
/**
* @file
* POP network mailbox
*
* @authors
* Copyright (C) 2000-2002 Vsevolod Volkov <vvv@mutt.org.ua>
* Copyright (C) 2006-2007,2009 Rocco Rutte <pdmef@gmx.net>
*
* @copyright
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as ... | cwe | CWE-824 | C/C++ |
function refresh()
{
layerCount = graph.model.getChildCount(graph.model.root)
listDiv.innerText = '';
layerDivs.clear();
function addLayer(index, label, child, defaultParent)
{
var ldiv = document.createElement('div');
ldiv.className = 'geToolbarContainer';
layerDivs.put(child, ldiv);
ldiv.st... | vuln | Safe | JavaScript |
from __future__ import annotations
from datetime import timedelta as td
from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from hc.accounts.models import REPORT_CHOICES, Member
from hc.api.models import TokenBucket
from hc.lib.tz import all_timezones
c... | vuln | Vulnerable | Python |
bool Item_default_value::fix_fields(THD *thd, Item **items)
{
Item *real_arg;
Item_field *field_arg;
Field *def_field;
DBUG_ASSERT(fixed == 0);
DBUG_ASSERT(arg);
/*
DEFAULT() do not need table field so should not ask handler to bring
field value (mark column for read)
*/
enum_column_usage save_... | vuln | Safe | Unknown |
header_put_le_int (SF_PRIVATE *psf, int x)
{ if (psf->headindex < SIGNED_SIZEOF (psf->header) - 4)
{ psf->header [psf->headindex++] = x ;
psf->header [psf->headindex++] = (x >> 8) ;
psf->header [psf->headindex++] = (x >> 16) ;
psf->header [psf->headindex++] = (x >> 24) ;
} ;
} /* header_put_le_int */ | cwe | CWE-787 | Unknown |
static bool checkreturn pb_dec_string(pb_istream_t *stream, const pb_field_t *field, void *dest)
{
uint32_t size;
size_t alloc_size;
bool status;
if (!pb_decode_varint32(stream, &size))
return false;
/* Space for null terminator */
alloc_size = size + 1;
if (PB_ATYPE(field-... | vuln | Vulnerable | C/C++ |
def self.save_sync_new_version(config, nodes, cluster_name, fetch_on_conflict, tokens={})
if not cluster_name or cluster_name.empty?
# we run on a standalone host, no config syncing
config.version += 1
config.save()
return true, {}
else
# we run in a cluster so we need to sync the ... | cwe | CWE-384 | Ruby |
static void gf_dump_vrml_dyn_field(GF_SceneDumper *sdump, GF_Node *node, GF_FieldInfo field, Bool has_sublist)
{
u32 i, sf_type;
void *slot_ptr;
if (gf_sg_vrml_is_sf_field(field.fieldType)) {
DUMP_IND(sdump);
if (sdump->XMLDump) {
if (sdump->X3DDump) {
gf_fprintf(sdump->trace, "<field name=\"%s\" type=\"... | cwe | CWE-476 | C/C++ |
public void setLicenseNicknames(String[] licenseNicknames) {
this.licenseNicknames = licenseNicknames;
} | vuln | Vulnerable | Java |
def _put_validation_file(self, domain, file_path, file_name, content):
"""Put file to the domain with validation content"""
request = {'packet': {'site': {'get': [
{'filter': {'name': domain}},
{'dataset': {'hosting': {}}},
]}}}
response = self.plesk_api_client.re... | vuln | Vulnerable | Python |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "hermes/VM/JSObject.h"
#include "hermes/VM/BuildMetadata.h"
#include "hermes/VM/Callable.h"
#include "hermes/VM/HostModel... | cwe | CWE-843 | C/C++ |
static inline int gen_iwmmxt_address(DisasContext *s, uint32_t insn, TCGv dest)
{
int rd;
uint32_t offset;
TCGv tmp;
rd = (insn >> 16) & 0xf;
tmp = load_reg(s, rd);
offset = (insn & 0xff) << ((insn >> 7) & 2);
if (insn & (1 << 24)) {
if (insn & (1 << 23))
tcg_gen... | vuln | Vulnerable | C/C++ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.