code
stringlengths
10
33.4M
task
stringclasses
2 values
label
stringclasses
121 values
language
stringclasses
13 values
package converter import ( "bytes" "github.com/asaskevich/govalidator" "github.com/microcosm-cc/bluemonday" "github.com/segmentfault/pacman/log" "github.com/yuin/goldmark" "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/extension" "github.com/yuin/goldmark/parser" "github.com/yuin/goldmark/renderer"...
cwe
CWE-79
Go
int utf8s_to_utf16s(const u8 *s, int len, wchar_t *pwcs) { u16 *op; int size; unicode_t u; op = pwcs; while (*s && len > 0) { if (*s & 0x80) { size = utf8_to_utf32(s, len, &u); if (size < 0) return -EINVAL; if (u >= PLANE_SIZE) { u -= PLANE_SIZE; *op++ = (wchar_t) (SURROGATE_P...
cwe
CWE-119
C/C++
on_response(void *data, krb5_error_code retval, otp_response response) { struct request_state rs = *(struct request_state *)data; free(data); if (retval == 0 && response != otp_response_success) retval = KRB5_PREAUTH_FAILED; rs.respond(rs.arg, retval, NULL, NULL, NULL); }
cwe
CWE-264
C/C++
static void scalar32_min_max_xor(struct bpf_reg_state *dst_reg, struct bpf_reg_state *src_reg) { bool src_known = tnum_subreg_is_const(src_reg->var_off); bool dst_known = tnum_subreg_is_const(dst_reg->var_off); struct tnum var32_off = tnum_subreg(dst_reg->var_off); s32 smin_val = src_reg->s32_min_value; /* A...
cwe
CWE-125
Unknown
ImagingPcdDecode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes) { int x; int chunk; UINT8* out; UINT8* ptr; ptr = buf; chunk = 3 * state->xsize; for (;;) { /* We need data for two full lines before we can do anything */ if (bytes < chunk) return ptr - buf; /* Unpack...
cwe
CWE-119
C/C++
/* Based on https://github.com/trevex/golem Licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.html */ package main import ( "bytes" "encoding/gob" _ "expvar" "fmt" "io/ioutil" "log" "net/http" "runtime" "sync" "time" "github.com/gorilla/websocket" //_ "github.com/mk...
cwe
CWE-862
Go
int tcp_emu(struct socket *so, struct mbuf *m) { Slirp *slirp = so->slirp; unsigned n1, n2, n3, n4, n5, n6; char buff[257]; uint32_t laddr; unsigned lport; char *bptr; DEBUG_CALL("tcp_emu"); DEBUG_ARG("so = %p", so); DEBUG_ARG("m = %p", m); switch (so->so_emu) { int x, ...
cwe
CWE-120
C/C++
static Status ParseEquation(const string& equation, OperandLabels* input_labels, Labels* output_labels, std::vector<DimensionType>* label_types, OperandLabelCounts* input_label_counts, ...
cwe
CWE-703
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....
cwe
CWE-94
JavaScript
static int decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned long size, struct strbuf *err) { const char *path; unsigned int mode, len; if (size < 23 || buf[size - 21]) { strbuf_addstr(err, _("too-short tree object")); return -1; } path = get_mode(buf, &mode); if (!path) { strbuf_addstr(...
cwe
CWE-20
C/C++
void show_ip(struct pt_regs *regs, const char *loglvl) { #ifdef CONFIG_X86_32 printk("%sEIP: %pS\n", loglvl, (void *)regs->ip); #else printk("%sRIP: %04x:%pS\n", loglvl, (int)regs->cs, (void *)regs->ip); #endif show_opcodes((u8 *)regs->ip, loglvl); }
cwe
CWE-20
Unknown
void impeg2d_dec_pnb_mb_params(dec_state_t *ps_dec) { stream_t *ps_stream = &ps_dec->s_bit_stream; UWORD16 u2_mb_addr_incr; UWORD16 u2_total_len; UWORD16 u2_len; UWORD16 u2_mb_type; UWORD32 u4_next_word; const dec_mb_params_t *ps_dec_mb_params; if(impeg2d_bit_stream_nxt(ps_stream,1) == 1) ...
cwe
CWE-119
C/C++
cJSON *cJSON_GetObjectItem( cJSON *object, const char *string ) { cJSON *c = object->child; while ( c && cJSON_strcasecmp( c->string, string ) ) c = c->next; return c; }
cwe
CWE-120
C/C++
static int read_gab2_sub(AVFormatContext *s, AVStream *st, AVPacket *pkt) { if (pkt->size >= 7 && pkt->size < INT_MAX - AVPROBE_PADDING_SIZE && !strcmp(pkt->data, "GAB2") && AV_RL16(pkt->data + 5) == 2) { uint8_t desc[256]; int score = AVPROBE_SCORE_EXTENSION, ret; AVISt...
cwe
CWE-200
Unknown
@app.route('/players/<int:player_id>/achievements') def achievements_list_player(player_id): """Lists the progress of achievements for a player. :param player_id: ID of the player. :return: If successful, this method returns a response body with the following structure:: { ...
cwe
CWE-89
Python
const got = require('@/utils/got'); const cheerio = require('cheerio'); const { parseDate } = require('@/utils/parse-date'); const defaults = require('./defaults'); const shortcuts = require('./shortcuts'); module.exports = async (ctx) => { const site = ctx.params[0] ?? 'news'; let items; let category = c...
cwe
CWE-918
JavaScript
/* radare - LGPL - Copyright 2019-2022 - GustavoLCR */ #include "ne.h" static char *__get_target_os(r_bin_ne_obj_t *bin) { switch (bin->ne_header->targOS) { case 1: return "OS/2"; case 2: return "Windows"; case 3: return "European MS-DOS 4.x"; case 4: return "Windows 386"; case 5: return "BOSS (Borlan...
cwe
CWE-476
C/C++
function C(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}
cwe
CWE-451
JavaScript
chkpass_in(PG_FUNCTION_ARGS) { char *str = PG_GETARG_CSTRING(0); chkpass *result; char mysalt[4]; char *crypt_output; static char salt_chars[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; /* special case to let us enter encrypted passwords */ if (*str == ':') { result = (c...
cwe
CWE-119
Unknown
func cmdList(args *docopt.Args, client *tuf.Client) error { if _, err := client.Update(); err != nil && !tuf.IsLatestSnapshot(err) { return err } targets, err := client.Targets() if err != nil { return err } w := tabwriter.NewWriter(os.Stdout, 1, 2, 2, ' ', 0) defer w.Flush() fmt.Fprintln(w, "PATH\tSIZE") ...
cwe
CWE-354
Go
compile_get_env(char_u **arg, cctx_T *cctx) { char_u *start = *arg; int len; int ret; char_u *name; ++*arg; len = get_env_len(arg); if (len == 0) { semsg(_(e_syntax_error_at_str), start - 1); return FAIL; } // include the '$' in the name, eval_env_var() expects it. name...
cwe
CWE-200
C/C++
_dopr(char **sbuffer, char **buffer, size_t *maxlen, size_t *retlen, int *truncated, const char *format, va_list args) { char ch; LLONG value; LDOUBLE fvalue; char *strvalue; int min; int max; int state; int flags; int cflags; size_t currlen; state = DP_S_D...
cwe
CWE-119
Unknown
PUBLIC ssize httpWriteUploadData(HttpConn *conn, MprList *fileData, MprList *formData) { char *path, *pair, *key, *value, *name; cchar *type; ssize rc; int next; rc = 0; if (formData) { for (rc = next = 0; rc >= 0 && (pair = mprGetNextItem(formData, &next)) != 0; ) { ...
cwe
CWE-476
C/C++
static Image *ReadTIFFImage(const ImageInfo *image_info, ExceptionInfo *exception) { #define ThrowTIFFException(severity,message) \ { \ if (pixel_info != (MemoryInfo *) NULL) \ pixel_info=RelinquishVirtualMemory(pixel_info); \ if (quantum_info != (QuantumInfo *) NULL) \ quantum_info=DestroyQuantumInfo(qua...
cwe
CWE-787
Unknown
/* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * * 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...
cwe
CWE-122
C/C++
readTile(T& in, bool reduceMemory , bool reduceTime) { bool threw = false; try { const Box2i& dw = in.header().dataWindow(); int w = dw.max.x - dw.min.x + 1; int h = dw.max.y - dw.min.y + 1; int dwx = dw.min.x; int dwy = dw.min.y; int numXLevels = in.numXLeve...
cwe
CWE-787
Unknown
static sk_sp<SkImage> unPremulSkImageToPremul(SkImage* input) { SkImageInfo info = SkImageInfo::Make(input->width(), input->height(), kN32_SkColorType, kPremul_SkAlphaType); RefPtr<Uint8Array> dstPixels = copySkImageData(input, info); if (!dstPixels) return nullptr; ...
cwe
CWE-787
C/C++
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2000-2012 * All rights reserved * * This file is part of GPAC / ISO Media File Format sub-project * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the GNU L...
cwe
CWE-125
C/C++
# # Copyright (c) 2010 - 2012 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. You should have received a ...
cwe
CWE-264
Python
state_separate_contexts (position_set const *s) { int separate_contexts = 0; unsigned int j; for (j = 0; j < s->nelem; ++j) { if (PREV_NEWLINE_DEPENDENT (s->elems[j].constraint)) separate_contexts |= CTX_NEWLINE; if (PREV_LETTER_DEPENDENT (s->elems[j].constraint)) separate_context...
cwe
CWE-189
Unknown
void CLASS rollei_load_raw() { uchar pixel[10]; unsigned iten=0, isix, i, buffer=0, todo[16]; isix = raw_width * raw_height * 5 / 8; while (fread (pixel, 1, 10, ifp) == 10) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); #endif for (i=0; i < 10; i+=2) { todo[i] = iten++; todo[i+1] = pixel[i]...
cwe
CWE-125
Unknown
static int __do_execve_file(int fd, struct filename *filename, struct user_arg_ptr argv, struct user_arg_ptr envp, int flags, struct file *file) { char *pathbuf = NULL; struct linux_binprm *bprm; struct files_struct *displaced; int retval; if (IS_ERR(filename)) return PTR_ERR(filename); /...
cwe
CWE-416
Unknown
showImportFileError(fileName, fileSize, message) { const $alert = $('.js-import-file-error'); const fileData = fileName + ' (' + this.humanizeSize(fileSize) + ')'; $alert.find('.js-file-data').html(fileData); $alert.find('.js-error-message').html(message); $alert.removeClass('d-none'); }
cwe
CWE-79
JavaScript
int partition_create(struct ldb_module *module, struct ldb_request *req) { unsigned int i; int ret; struct ldb_context *ldb = ldb_module_get_ctx(module); struct ldb_request *mod_req, *last_req = req; struct ldb_message *mod_msg; struct partition_private_data *data; struct dsdb_partition *partition = NULL; const...
cwe
CWE-200
Unknown
# coding=utf-8 from __future__ import unicode_literals import logging import platform import re import subprocess import sys from medusa import app, notifiers from medusa.logger.adapters.style import BraceAdapter from medusa.updater.update_manager import UpdateManager from six import text_type ERROR_MESSAGE = ('U...
cwe
CWE-78
Python
static void userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx, struct userfaultfd_wait_queue *ewq) { if (WARN_ON_ONCE(current->flags & PF_EXITING)) goto out; ewq->ctx = ctx; init_waitqueue_entry(&ewq->wq, current); spin_lock(&ctx->event_wqh.lock); /* * After the __add_wait_queue the uw...
cwe
CWE-416
C/C++
/* * See the NOTICE file distributed with this work for additional * information regarding copyright ownership. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * th...
cwe
CWE-863
Java
package com.bezman.servlet; import com.bezman.background.ItemSale; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bi...
cwe
CWE-89
Java
void PPB_Widget_Impl::Invalidate(const PP_Rect* dirty) { const PPP_Widget_Dev* widget = static_cast<const PPP_Widget_Dev*>( instance()->module()->GetPluginInterface(PPP_WIDGET_DEV_INTERFACE)); if (!widget) return; ScopedResourceId resource(this); widget->Invalidate(instance()->pp_instance(), resour...
cwe
CWE-416
C/C++
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...
cwe
CWE-190
C/C++
package com.salesmanager.shop.admin.model.web; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class Menu implements Serializable { /** * */ private static final long serialVersionUID = 1L; private String code; ...
cwe
CWE-79
Java
BinaryParameter::BinaryParameter(const char* name_, const char* desc_, const void* v, int l, ConfigurationObject co) : VoidParameter(name_, desc_, co), value(0), length(0), def_value((char*)v), def_length(l) { if (l) { value = new char[l]; length = l; memcpy(value, v, l); } }
cwe
CWE-787
C/C++
package sso import ( "bytes" "crypto/rand" "crypto/x509" "encoding/base64" "encoding/xml" "errors" "fmt" "strings" "time" "github.com/beevik/etree" "github.com/fleetdm/fleet/v4/server/fleet" rtvalidator "github.com/mattermost/xml-roundtrip-validator" dsig "github.com/russellhaering/goxmldsig" "github.co...
cwe
CWE-287
Go
function twig_array_reduce(Environment $env, $array, $arrow, $initial = null) { if (!$arrow instanceof Closure && $env->hasExtension('\Twig\Extension\SandboxExtension') && $env->getExtension('\Twig\Extension\SandboxExtension')->isSandboxed()) { throw new RuntimeError('The callable passed to the "reduce" fil...
cwe
CWE-74
PHP
printer_open(struct inode *inode, struct file *fd) { struct printer_dev *dev; unsigned long flags; int ret = -EBUSY; dev = container_of(inode->i_cdev, struct printer_dev, printer_cdev); spin_lock_irqsave(&dev->lock, flags); if (dev->interface < 0) { spin_unlock_irqrestore(&dev->lock, flags); return -ENO...
cwe
CWE-416
Unknown
bool ConstantFolding::IsSimplifiableReshape( const NodeDef& node, const GraphProperties& properties) const { if (!IsReshape(node)) { return false; } CHECK_LE(2, node.input_size()); const NodeDef* new_shape = node_map_->GetNode(node.input(1)); if (!IsReallyConstant(*new_shape)) { return false; } ...
cwe
CWE-617
C/C++
static MagickBooleanType WritePALMImage(const ImageInfo *image_info, Image *image,ExceptionInfo *exception) { MagickBooleanType status; MagickOffsetType currentOffset, offset, scene; MagickSizeType cc; PixelInfo transpix; QuantizeInfo *quantize_info; register ssize_t x...
cwe
CWE-703
C/C++
txid_snapshot_recv(PG_FUNCTION_ARGS) { StringInfo buf = (StringInfo) PG_GETARG_POINTER(0); TxidSnapshot *snap; txid last = 0; int nxip; int i; int avail; int expect; txid xmin, xmax; /* * load nxip and check for nonsense. * * (nxip > avail) check is against int overflows in 'expect'. */ ...
cwe
CWE-189
C/C++
ubpf_load_elf(struct ubpf_vm *vm, const void *elf, size_t elf_size, char **errmsg) { struct bounds b = { .base=elf, .size=elf_size }; void *text_copy = NULL; int i; const Elf64_Ehdr *ehdr = bounds_check(&b, 0, sizeof(*ehdr)); if (!ehdr) { *errmsg = ubpf_error("not enough data for ELF header...
cwe
CWE-190
C/C++
static int fuse_notify_inval_entry(struct fuse_conn *fc, unsigned int size, struct fuse_copy_state *cs) { struct fuse_notify_inval_entry_out outarg; int err = -ENOMEM; char *buf; struct qstr name; buf = kzalloc(FUSE_NAME_MAX + 1, GFP_KERNEL); if (!buf) goto err; err = -EINVAL; if (size < sizeof(outar...
cwe
CWE-119
C/C++
/* * Copyright (c) 2009-2017 Nicira, Inc. * Copyright (c) 2010 Jean Tourrilhes - HP-Labs. * * 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/LICEN...
cwe
CWE-20
C/C++
static int evp_EncryptDecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl) { int i, j, bl, cmpl = inl; if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS)) cmpl = (cmpl + 7) ...
cwe
CWE-190
Unknown
it "should reject a subjectAltName for a non-DNS value" do @request.stubs(:subject_alt_names).returns ['DNS:foo', 'email:bar@example.com'] expect { @ca.sign(@name, true) }.to raise_error( Puppet::SSL::CertificateAuthority::CertificateSigningError, /subjectAltName outside the DNS labe...
cwe
CWE-264
Ruby
sds sdsMakeRoomFor(sds s, size_t addlen) { void *sh, *newsh; size_t avail = sdsavail(s); size_t len, newlen; char type, oldtype = s[-1] & SDS_TYPE_MASK; int hdrlen; size_t usable; /* Return ASAP if there is enough space left. */ if (avail >= addlen) return s; len = sdslen(s); s...
cwe
CWE-190
Unknown
static TfLiteStatus InitTemporaryTensors(TfLiteContext* context, TfLiteNode* node) { OpData* data = reinterpret_cast<OpData*>(node->user_data); // The prepare function may be executed multiple times. But temporary tensors // only need to be initiated once. if (data->fft_...
cwe
CWE-787
C/C++
parsePath (rawPath, opts = {}) { let pathObj = { locale: WIKI.config.lang.code, path: 'home', private: false, privateNS: '', explicitLocale: false } // Clean Path rawPath = _.trim(qs.unescape(rawPath)) if (_.startsWith(rawPath, '/')) { rawPath = rawPath.substring(1) } ...
cwe
CWE-22
JavaScript
import { AnalyticsAdapter } from '../Adapters/Analytics/AnalyticsAdapter'; import { FilesAdapter } from '../Adapters/Files/FilesAdapter'; import { LoggerAdapter } from '../Adapters/Logger/LoggerAdapter'; import { StorageAdapter } from '../Adapters/Storage/StorageAdapter'; import { CacheAdapter } from '../Adapters/Cache...
cwe
CWE-74
JavaScript
static int tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen, const unsigned char *sess_id, int sesslen, SSL_SESSION **psess) { SSL_SESSION *sess; unsigned char *sdec; const unsigned char *p; int slen, mlen, renew_ticket = 0; unsigned char tick_hmac[EVP_MAX_MD_SIZE]; HMAC_CTX hctx; EVP...
cwe
CWE-310
Unknown
NativeBrowserFrame* NativeBrowserFrame::CreateNativeBrowserFrame( BrowserFrame* browser_frame, BrowserView* browser_view) { if (views::Widget::IsPureViews()) return new BrowserFrameViews(browser_frame, browser_view); return new BrowserFrameGtk(browser_frame, browser_view); }
cwe
CWE-416
C/C++
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { // Check that the inputs and outputs have the right sizes and types. TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 2); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTenso...
cwe
CWE-787
C/C++
static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size, void *data) { int ret; ret = usb_control_msg(pegasus->usb, usb_sndctrlpipe(pegasus->usb, 0), PEGASUS_REQ_SET_REGS, PEGASUS_REQT_WRITE, 0, indx, data, size, 100); if (ret < 0) netif_dbg(pegasus, drv, pegasus->net, "...
cwe
CWE-119
C/C++
/*! * assign-deep <https://github.com/jonschlinkert/assign-deep> * * Copyright (c) 2017-present, Jon Schlinkert. * Released under the MIT License. */ 'use strict'; const assignSymbols = require('assign-symbols'); const toString = Object.prototype.toString; const assign = module.exports = (target, ...args) => { ...
cwe
CWE-20
Java
static int base64decode_block(unsigned char *target, const char *data, size_t data_size) { int w1,w2,w3,w4; int i; size_t n; if (!data || (data_size <= 0)) { return 0; } n = 0; i = 0; while (n < data_size-3) { w1 = base64_table[(int)data[n]]; w2 = base64_table[(int)data[n+1]]; w3 = base64_table[(int)dat...
cwe
CWE-125
C/C++
void ComparisonQuantized(const TfLiteTensor* input1, const TfLiteTensor* input2, TfLiteTensor* output, bool requires_broadcast) { if (input1->type == kTfLiteUInt8 || input1->type == kTfLiteInt8) { auto input1_offset = -input1->params.zero_point; auto input2_offset = -input2->params.ze...
cwe
CWE-703
C/C++
public TSet readSetBegin() throws TException { return new TSet(readByte(), readI32()); }
cwe
CWE-770
Java
/* * GPAC - Multimedia Framework C SDK * * Authors: Jean Le Feuvre * Copyright (c) Telecom ParisTech 2000-2021 * All rights reserved * * This file is part of GPAC / ISO Media File Format sub-project * * GPAC is free software; you can redistribute it and/or modify * it under the terms of the GNU L...
cwe
CWE-476
C/C++
ArgParser::handleBashArguments() { // Do a minimal job of parsing bash_line into arguments. This // doesn't do everything the shell does (e.g. $(...), variable // expansion, arithmetic, globs, etc.), but it should be good // enough for purposes of handling completion. As we build up the // new argv,...
cwe
CWE-787
Unknown
void OneHotComputeImpl(const OneHotContext& op_context) { // prefix_dim_size == # of elements before the axis // depth == # of elements per axis // suffix_dim_size == # of elements after the axis int prefix_dim_size = 1; for (int i = 0; i < op_context.axis; ++i) { prefix_dim_size *= op_context.indices->di...
cwe
CWE-369
Unknown
xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, int what, xmlChar end, xmlChar end2, xmlChar end3) { xmlChar *buffer = NULL; int buffer_size = 0; xmlChar *current = NULL; xmlChar *rep = NULL; const xmlChar *last; xmlEntityPtr ent; int c,l; int nbc...
cwe
CWE-787
C/C++
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
cwe
CWE-369
Python
goa_ews_client_autodiscover (GoaEwsClient *client, const gchar *email, const gchar *password, const gchar *username, const gchar *server, ...
cwe
CWE-310
Unknown
function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){ var isHTML = MIME_TYPE.isHTML(domBuilder.mimeType); function fixedFromCharCode(code) { // String.prototype.fromCharCode does not supports // > 2 bytes unicode chars directly if (code > 0xffff) { code -= 0x10000; var surrogate1 = 0x...
cwe
CWE-1321
JavaScript
/* * * Copyright 2019 Asylo 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 agree...
cwe
CWE-125
C/C++
errno_t sssctl_logs_remove(struct sss_cmdline *cmdline, struct sss_tool_ctx *tool_ctx, void *pvt) { struct sssctl_logs_opts opts = {0}; errno_t ret; /* Parse command line. */ struct poptOption options[] = { {"delete", 'd', POPT_ARG_NONE, &op...
cwe
CWE-78
Unknown
png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) { png_uint_32 chunk_name; #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED int keep; /* unknown handling method */ #endif png_alloc_size_t limit = PNG_UINT_31_MAX; /* First we make sure we have enough data for the 4-byte chunk name * and the 4-byte c...
cwe
CWE-369
Unknown
#!/usr/bin/env python3 from apkleaks.colors import clr from contextlib import closing from distutils.spawn import find_executable from pyaxmlparser import APK from urllib.request import urlopen from zipfile import ZipFile import io import json import logging.config import mimetypes import numpy import os import re impo...
cwe
CWE-78
Python
def GetActionRateLimited(rateLimits: RateLimits = RateLimits.ExpensiveGetRequest, allowAnyone: Boolean = false)(f: GetRequest => Result): Action[Unit] = PlainApiAction(cc.parsers.empty, rateLimits, allowAnyone = allowAnyone)(f)
cwe
CWE-613
Scala
file_printable(char *buf, size_t bufsiz, const char *str) { char *ptr, *eptr; const unsigned char *s = (const unsigned char *)str; for (ptr = buf, eptr = ptr + bufsiz - 1; ptr < eptr && *s; s++) { if (isprint(*s)) { *ptr++ = *s; continue; } if (ptr >= eptr + 4) break; *ptr++ = '\\'; *ptr++ = ((*s...
cwe
CWE-20
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 ...
cwe
CWE-613
Python
static int fuse_writepages(struct address_space *mapping, struct writeback_control *wbc) { struct inode *inode = mapping->host; struct fuse_conn *fc = get_fuse_conn(inode); struct fuse_fill_wb_data data; int err; err = -EIO; if (is_bad_inode(inode)) goto out; data.inode = inode; data.wpa = NULL; data...
cwe
CWE-459
Unknown
unsigned char *ziplistMerge(unsigned char **first, unsigned char **second) { /* If any params are null, we can't merge, so NULL. */ if (first == NULL || *first == NULL || second == NULL || *second == NULL) return NULL; /* Can't merge same list into itself. */ if (*first == *second) retu...
cwe
CWE-190
Unknown
/* * linux/net/sunrpc/svc.c * * High-level RPC service routines * * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> * * Multiple threads pools and NUMAisation * Copyright (c) 2006 Silicon Graphics, Inc. * by Greg Banks <gnb@melbourne.sgi.com> */ #include <linux/linkage.h> #include <linux/sched/signal...
cwe
CWE-399
C/C++
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
cwe
CWE-787
Python
@hook.command(autohelp=False) def showPoll(pollID, db=None): """Shows the answers for a given poll.""" if not db_ready: db_init(db) if pollID == None: poll = db.execute("SELECT pollID, question FROM polls WHERE active = 1") if len(poll) == 0: reply("There's no poll open.") ...
cwe
CWE-89
Python
public function pinCommentAction(ProjectComment $comment) { $comment->setPinned(!$comment->isPinned()); try { $this->repository->saveComment($comment); } catch (\Exception $ex) { $this->flashUpdateException($ex); } return $this->redirectToRoute('proje...
cwe
CWE-352
PHP
BGD_DECLARE(void) gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) { int lastBorder; /* Seek left */ int leftLimit, rightLimit; int i; int restoreAlphaBleding; if (border < 0) { /* Refuse to fill to a non-solid border */ return; } leftLimit = (-1); restoreAlphaBleding = im->alpha...
cwe
CWE-119
Unknown
static void ima_adpcm_run_pull (_AFmoduleinst *module) { ima_adpcm_data *d = (ima_adpcm_data *) module->modspec; AFframecount frames2read = module->outc->nframes; AFframecount nframes = 0; int i, framesPerBlock, blockCount; ssize_t blocksRead, bytesDecoded; framesPerBlock = d->samplesPerBlock / d->track->f.cha...
cwe
CWE-119
Unknown
int expand_downwards(struct vm_area_struct *vma, unsigned long address) { struct mm_struct *mm = vma->vm_mm; int error; address &= PAGE_MASK; error = security_mmap_addr(address); if (error) return error; /* We must make sure the anon_vma is allocated. */ if (unlikely(anon_vma_prepare(vma))) return -...
cwe
CWE-119
Unknown
static int tomoyo_mount_acl(struct tomoyo_request_info *r, char *dev_name, struct path *dir, char *type, unsigned long flags) { struct path path; struct file_system_type *fstype = NULL; const char *requested_type = NULL; const char *requested_dir_name = NULL; const char *requested_dev_name = NULL; struct t...
cwe
CWE-20
C/C++
"""Meta related things.""" from collections import namedtuple import re RE_VER = re.compile( r'''(?x) (?P<major>\d+)(?:\.(?P<minor>\d+))?(?:\.(?P<micro>\d+))? (?:(?P<type>a|b|rc)(?P<pre>\d+))? (?:\.post(?P<post>\d+))? (?:\.dev(?P<dev>\d+))? ''' ) REL_MAP = { ".dev": "", ".dev-alpha": "...
cwe
CWE-22
Python
Status AutoParallel::Initialize(const GrapplerItem& item) { num_gpus_ = GetNumAvailableGPUs(); LOG(INFO) << "Number of GPUs: " << num_gpus_; item_ = &item; graph_ = item.graph; LOG(INFO) << "Original graph size: " << graph_.node_size(); if (item.fetch.empty()) { return Status(error::INVALID_ARGUMENT, "N...
cwe
CWE-703
C/C++
function peg$parseraw() { var s0, s1, s2, s3, s4, s5; peg$silentFails++; s0 = peg$currPos; if (input.substr(peg$currPos, 2) === peg$c98) { s1 = peg$c98; peg$currPos += 2; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c99); } } ...
cwe
CWE-1321
JavaScript
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...
cwe
CWE-119
Unknown
void CLASS rollei_load_raw() { uchar pixel[10]; unsigned iten=0, isix, i, buffer=0, todo[16]; isix = raw_width * raw_height * 5 / 8; while (fread (pixel, 1, 10, ifp) == 10) { #ifdef LIBRAW_LIBRARY_BUILD checkCancel(); #endif for (i=0; i < 10; i+=2) { todo[i] = iten++; todo[i+1] = pixel[i]...
cwe
CWE-787
Unknown
void PrintPreviewDataService::RemoveEntry( const std::string& preview_ui_addr_str) { PreviewDataStoreMap::iterator it = data_store_map_.find(preview_ui_addr_str); if (it != data_store_map_.end()) data_store_map_.erase(it); }
cwe
CWE-200
C/C++
int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index) { struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table; int i, err = 0; int free = -1; mutex_lock(&table->mutex); for (i = MLX4_VLAN_REGULAR; i < MLX4_MAX_VLAN_NUM; i++) { if (free < 0 && (table->refs[i] == 0)) { fr...
cwe
CWE-119
C/C++
private AbstractAuthorityFactory createBackingStore0() throws FactoryException, SQLException { /* * We are locking on ReferencingFactoryFinder to avoid deadlocks. * @see DeferredAuthorityFactory#getBackingStore() */ assert Thread.holdsLock(ReferencingFactoryFinder.class); ...
cwe
CWE-20
Java
app.post('/ldap', set_current_config, function(req, res, next) { // Convert ENABLE_WRITE_BACK and ENABLE_ACTIVE_DIRECTORY_UNICODE_PASSWORD to boolean. req.body.ENABLE_WRITE_BACK = !!(req.body.ENABLE_WRITE_BACK && req.body.ENABLE_WRITE_BACK === 'on'); req.body.ENABLE_ACTIVE_DIRECTORY_UNICODE_PASSWORD = !!(req.body...
cwe
CWE-352
JavaScript
void dns_server_unlink(DnsServer *s) { assert(s); assert(s->manager); /* This removes the specified server from the linked list of * servers, but any server might still stay around if it has * refs, for example from an ongoing transaction. */ if (!s->linked) ...
cwe
CWE-416
Unknown
__reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode, int type, struct posix_acl *acl) { char *name; void *value = NULL; size_t size = 0; int error; switch (type) { case ACL_TYPE_ACCESS: name = XATTR_NAME_POSIX_ACL_ACCESS; if (acl) { error = posix_acl_equiv_mode(acl, &inode->i...
cwe
CWE-285
Unknown