diff --git "a/validation.jsonl" "b/validation.jsonl" --- "a/validation.jsonl" +++ "b/validation.jsonl" @@ -1,5259 +1,3984 @@ -{"code": " $this->aliases[$s] = $d->id->toString();\n }\n array_pop($this->context);\n }", "label": 1, "label_name": "safe"} -{"code": " it 'should work with no errors' do\n pp = <<-EOS\n class { 'apache': }\n EOS\n\n # Run it twice and test for idempotency\n apply_manifest(pp, :catch_failures => true)\n expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero\n end\n\n describe package(package_name) do\n it { is_expected.to be_installed }\n end\n\n describe service(service_name) do\n it { is_expected.to be_enabled }\n it { is_expected.to be_running }\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": "(function(){(function(){$.browser.webkit||$.event.add(window,\"load\",function(){$(\"a[href][rel~=noreferrer], area[href][rel~=noreferrer]\").each(function(){var b,e,c,g,d,f,h;b=this;c=b.href;$.browser.opera?(b.href=\"http://www.google.com/url?q=\"+encodeURIComponent(c),b.title||(b.title=\"Go to \"+c)):(d=!1,g=function(){b.href=\"javascript:void(0)\"},f=function(){b.href=c},$(b).bind(\"mouseout mouseover focus blur\",f).mousedown(function(a){a.which===2&&(d=!0)}).blur(function(){d=!1}).mouseup(function(a){if(!(a.which===", "label": 1, "label_name": "safe"} -{"code": " public function decrementCounter()\n {\n $this->elCounter--;\n }", "label": 1, "label_name": "safe"} -{"code": " it 'setup mysql::server' do\n pp = <<-EOS\n class { 'mysql::server': }\n EOS\n\n apply_manifest(pp, :catch_failures => true)\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": " public LocalizationSetContentPickerAdminController(\n IContentDefinitionManager contentDefinitionManager,\n IContentLocalizationManager contentLocalizationManager,\n IContentManager contentManager,\n ISession session\n )\n {\n _contentDefinitionManager = contentDefinitionManager;\n _contentLocalizationManager = contentLocalizationManager;\n _contentManager = contentManager;\n _session = session;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " it \"delegates to the cluster\" do\n session.cluster.should_receive(:socket_for).with(:read)\n session.send(:socket_for, :read)\n end", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic function getPurchaseOrderByJSON() {\n\t\t\n\t\tif(!empty($this->params['vendor'])) {\n\t\t\t$purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']);\n\t\t} else {\n\t\t\t$purchase_orders = $this->purchase_order->find('all');\n\t\t}\n\t\t\n\t\techo json_encode($purchase_orders);\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": " labels: templateInstance.topTasks.get().map((task) => task._id),\n datasets: [{\n values: templateInstance.topTasks.get().map((task) => task.count),\n }],\n },\n tooltipOptions: {\n },\n })\n })\n })\n }\n }\n })", "label": 0, "label_name": "vulnerable"} -{"code": "set_umask(const char *optarg)\n{\n\tlong umask_long;\n\tmode_t umask_val;\n\tchar *endptr;\n\n\tumask_long = strtoll(optarg, &endptr, 0);\n\n\tif (*endptr || umask_long < 0 || umask_long & ~0777L) {\n\t\tfprintf(stderr, \"Invalid --umask option %s\", optarg);\n\t\treturn;\n\t}\n\n\tumask_val = umask_long & 0777;\n\tumask(umask_val);\n\n\tumask_cmdline = true;\n\n\treturn umask_val;\n}", "label": 1, "label_name": "safe"} -{"code": "static pyc_object *get_tuple_object(RBuffer *buffer) {\n\tpyc_object *ret = NULL;\n\tbool error = false;\n\tut32 n = 0;\n\n\tn = get_ut32 (buffer, &error);\n\tif (n > ST32_MAX) {\n\t\teprintf (\"bad marshal data (tuple size out of range)\\n\");\n\t\treturn NULL;\n\t}\n\tif (error) {\n\t\treturn NULL;\n\t}\n\tret = get_array_object_generic (buffer, n);\n\tif (ret) {\n\t\tret->type = TYPE_TUPLE;\n\t\treturn ret;\n\t}\n\treturn NULL;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " it 'validates a fail command with a custom error message' do\n pp = <<-EOS\n $one = 'foo'\n if $::osfamily == 'windows' {\n $two = 'C:/aoeu'\n } else {\n $two = '/bin/aoeu'\n }\n validate_cmd($one,$two,\"aoeu is dvorak\")\n EOS\n\n apply_manifest(pp, :expect_failures => true) do |output|\n expect(output.stderr).to match(/aoeu is dvorak/)\n end\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": " $contents = ['form' => tep_draw_form('currencies', 'currencies.php', 'page=' . $_GET['page'] . (isset($cInfo) ? '&cID=' . $cInfo->currencies_id : '') . '&action=insert')];", "label": 0, "label_name": "vulnerable"} -{"code": "function u(a){return a.type==CKEDITOR.NODE_ELEMENT&&(a.name==\"br\"||q.$block[a.name])}function f(a,b,c){var d=a.name;if(q.$empty[d]||!a.children.length)if(d==\"hr\"&&b==\"br\")a.replaceWith(o());else{a.parent&&c.push({check:\"it\",el:a.parent});a.remove()}else if(q.$block[d]||d==\"tr\")if(b==\"br\"){if(a.previous&&!u(a.previous)){b=o();b.insertBefore(a)}if(a.next&&!u(a.next)){b=o();b.insertAfter(a)}a.replaceWithChildren()}else{var d=a.children,f;b:{f=q[b];for(var e=0,l=d.length,k;e=CKEDITOR.env.version,h;if(!c.getById(\"cke_pastebin\")){var o=b.getSelection(),v=o.createBookmarks(),", "label": 1, "label_name": "safe"} -{"code": " function manage() {\n global $db, $router, $user;\n\n expHistory::set('manageable', $router->params);\n assign_to_template(array(\n 'canManageStandalones' => self::canManageStandalones(),\n 'sasections' => $db->selectObjects('section', 'parent=-1'),\n 'user' => $user,\n// 'canManagePagesets' => $user->isAdmin(),\n// 'templates' => $db->selectObjects('section_template', 'parent=0'),\n ));\n }", "label": 1, "label_name": "safe"} -{"code": " def acceptInvite(secretKey: String): Action[Unit] = GetActionIsLogin { request =>\n import request.dao\n // Below, we accept invites already sent, even if SSO now enabled. (Makes sense? Or not?\n // Or config option?) However, rejected here: (4RBKA20).\n\n val (newUser, invite, alreadyAccepted) = dao.acceptInviteCreateUser(\n secretKey, request.theBrowserIdData)\n\n dao.pubSub.userIsActive(request.siteId, newUser.briefUser, request.theBrowserIdData)\n val (_, _, sidAndXsrfCookies) = createSessionIdAndXsrfToken(request.siteId, newUser.id)\n val newSessionCookies = sidAndXsrfCookies\n\n if (!alreadyAccepted) {\n // Could try to ensure this happens also if the server crashes here? [retry-after-crash]\n val settings = dao.getWholeSiteSettings()\n val welcomeEmail = makeWelcomeSetPasswordEmail(newUser, request.host,\n langCode = settings.languageCode)\n dao.saveUnsentEmail(welcomeEmail) // COULD (should?) mark as sent, how?\n globals.sendEmail(welcomeEmail, request.siteId)\n\n val inviter = dao.getParticipant(invite.createdById) getOrDie \"DwE4KDEP0\"\n val inviteAcceptedEmail = makeYourInviteWasAcceptedEmail(\n request.host, newUser, inviter, langCode = settings.languageCode)\n globals.sendEmail(inviteAcceptedEmail, request.siteId)\n // COULD create a notification instead / too.\n }\n\n Redirect(\"/\").withCookies(newSessionCookies: _*)\n }\n\n\n def loadInvites(sentById: UserId): Action[Unit] = GetAction { request =>", "label": 0, "label_name": "vulnerable"} -{"code": "ossl_cipher_initialize(VALUE self, VALUE str)\n{\n EVP_CIPHER_CTX *ctx;\n const EVP_CIPHER *cipher;\n char *name;\n\n name = StringValueCStr(str);\n GetCipherInit(self, ctx);\n if (ctx) {\n\tossl_raise(rb_eRuntimeError, \"Cipher already inititalized!\");\n }\n AllocCipher(self, ctx);\n if (!(cipher = EVP_get_cipherbyname(name))) {\n\tossl_raise(rb_eRuntimeError, \"unsupported cipher algorithm (%\"PRIsVALUE\")\", str);\n }\n if (EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, -1) != 1)\n\tossl_raise(eCipherError, NULL);\n\n return self;\n}", "label": 1, "label_name": "safe"} -{"code": " function selectObjects($table, $where = null, $orderby = null) {\n if ($where == null)\n $where = \"1\";\n else\n $where = $this->injectProof($where);\n if ($orderby == null)\n $orderby = '';\n else\n $orderby = \"ORDER BY \" . $orderby;\n\n $res = @mysqli_query($this->connection, \"SELECT * FROM `\" . $this->prefix . \"$table` WHERE $where $orderby\");\n if ($res == null)\n return array();\n $objects = array();\n for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++)\n $objects[] = mysqli_fetch_object($res);\n return $objects;\n }", "label": 1, "label_name": "safe"} -{"code": " it \"should convert MB to B\" do\n result = scope.function_to_bytes([\"4 MB\"])\n expect(result).to(eq(4194304))\n end", "label": 0, "label_name": "vulnerable"} -{"code": "TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {\n auto* data =\n reinterpret_cast(node->user_data);\n\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n\n const TfLiteTensor* input;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kInputTensor, &input));\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n\n TF_LITE_ENSURE_EQ(context, NumDimensions(input), 1);\n\n TF_LITE_ENSURE_EQ(context, input->type, kTfLiteInt16);\n output->type = kTfLiteInt32;\n if (data->out_float) {\n output->type = kTfLiteFloat32;\n }\n\n TfLiteIntArray* output_size = TfLiteIntArrayCreate(2);\n int num_frames = 0;\n if (input->dims->data[0] >= data->state->window.size) {\n num_frames = (input->dims->data[0] - data->state->window.size) /\n data->state->window.step / data->frame_stride +\n 1;\n }\n output_size->data[0] = num_frames;\n output_size->data[1] = data->state->filterbank.num_channels *\n (1 + data->left_context + data->right_context);\n\n return context->ResizeTensor(context, output, output_size);\n}", "label": 1, "label_name": "safe"} -{"code": " public String getDefaultReadGroupName(Collection collection, String typeOfGroupString) {\n return \"COLLECTION_\" + collection.getID().toString() + \"_\" + typeOfGroupString +\n \"_DEFAULT_READ\";\n }", "label": 1, "label_name": "safe"} -{"code": " api.remove = async function(req, res) {\n const commentId = req.body.comment_id;\n if (!commentId) {\n return Promise.resolve(res.json(ApiResponse.error('\\'comment_id\\' is undefined')));\n }\n\n try {\n const comment = await Comment.findById(commentId).exec();\n\n if (comment == null) {\n throw new Error('This comment does not exist.');\n }\n\n // check whether accessible\n const pageId = comment.page;\n const isAccessible = await Page.isAccessiblePageByViewer(pageId, req.user);\n if (!isAccessible) {\n throw new Error('Current user is not accessible to this page.');\n }\n if (req.user.id !== comment.creator.toString()) {\n throw new Error('Current user is not operatable to this comment.');\n }\n\n await comment.removeWithReplies();\n await Page.updateCommentCount(comment.page);\n }\n catch (err) {\n return res.json(ApiResponse.error(err));\n }\n\n return res.json(ApiResponse.success({}));\n };", "label": 1, "label_name": "safe"} -{"code": " protected function setupCacheMock($type)\n {\n // inject our definition cache mock globally (borrowed from\n // DefinitionFactoryTest)\n generate_mock_once(\"HTMLPurifier_DefinitionCacheFactory\");\n $factory = new HTMLPurifier_DefinitionCacheFactoryMock();\n $this->oldFactory = HTMLPurifier_DefinitionCacheFactory::instance();\n HTMLPurifier_DefinitionCacheFactory::instance($factory);\n generate_mock_once(\"HTMLPurifier_DefinitionCache\");\n $mock = new HTMLPurifier_DefinitionCacheMock();\n $config = HTMLPurifier_Config::createDefault();\n $factory->returns('create', $mock, array($type, $config));\n return array($mock, $config);\n }", "label": 1, "label_name": "safe"} -{"code": "func (m *Nil) Unmarshal(dAtA []byte) error {\n\tl := len(dAtA)\n\tiNdEx := 0\n\tfor iNdEx < l {\n\t\tpreIndex := iNdEx\n\t\tvar wire uint64\n\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\tif shift >= 64 {\n\t\t\t\treturn ErrIntOverflowFuzz\n\t\t\t}\n\t\t\tif iNdEx >= l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tb := dAtA[iNdEx]\n\t\t\tiNdEx++\n\t\t\twire |= uint64(b&0x7F) << shift\n\t\t\tif b < 0x80 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfieldNum := int32(wire >> 3)\n\t\twireType := int(wire & 0x7)\n\t\tif wireType == 4 {\n\t\t\treturn fmt.Errorf(\"proto: Nil: wiretype end group for non-group\")\n\t\t}\n\t\tif fieldNum <= 0 {\n\t\t\treturn fmt.Errorf(\"proto: Nil: illegal tag %d (wire type %d)\", fieldNum, wire)\n\t\t}\n\t\tswitch fieldNum {\n\t\tdefault:\n\t\t\tiNdEx = preIndex\n\t\t\tskippy, err := skipFuzz(dAtA[iNdEx:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif (skippy < 0) || (iNdEx+skippy) < 0 {\n\t\t\t\treturn ErrInvalidLengthFuzz\n\t\t\t}\n\t\t\tif (iNdEx + skippy) > l {\n\t\t\t\treturn io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\tm.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)\n\t\t\tiNdEx += skippy\n\t\t}\n\t}\n\n\tif iNdEx > l {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\treturn nil\n}", "label": 1, "label_name": "safe"} -{"code": " public function save()\n {\n $project = $this->getProject();\n\n $values = $this->request->getValues();\n list($valid, $errors) = $this->categoryValidator->validateCreation($values);\n\n if ($valid) {\n if ($this->categoryModel->create($values) !== false) {\n $this->flash->success(t('Your category have been created successfully.'));\n $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])), true);\n return;\n } else {\n $errors = array('name' => array(t('Another category with the same name exists in this project')));\n }\n }\n\n $this->create($values, $errors);\n }", "label": 0, "label_name": "vulnerable"} -{"code": " emailIconClassName: this.getMetadata().get(['clientDefs', 'Email', 'iconClass']) || ''\n }, Dep.prototype.data.call(this));\n },\n\n setup: function () {\n var data = this.model.get('data') || {};\n\n this.emailId = data.emailId;\n this.emailName = data.emailName;\n\n if (\n this.parentModel\n &&\n (this.model.get('parentType') == this.parentModel.name && this.model.get('parentId') == this.parentModel.id)\n ) {\n if (this.model.get('post')) {\n this.createField('post', null, null, 'views/stream/fields/post');\n this.hasPost = true;\n }\n if ((this.model.get('attachmentsIds') || []).length) {\n this.createField('attachments', 'attachmentMultiple', {}, 'views/stream/fields/attachment-multiple');\n this.hasAttachments = true;\n }\n }\n\n this.messageData['email'] = '' + this.getHelper().escapeString(data.emailName) + '';\n\n this.messageName = 'emailReceived';\n\n if (data.isInitial) {\n this.messageName += 'Initial';\n }\n\n if (data.personEntityId) {\n this.messageName += 'From';\n this.messageData['from'] = '' + this.getHelper().escapeString(data.personEntityName) + '';\n }\n\n if (this.model.get('parentType') === data.personEntityType && this.model.get('parentId') == data.personEntityId) {\n this.isThis = true;\n }\n\n if (this.isThis) {\n this.messageName += 'This';\n }\n\n this.createMessage();\n },\n\n });\n});", "label": 1, "label_name": "safe"} -{"code": " function decodeMap (buf, offset, length, headerLength, options) {\n const _temp = decodeArray(buf, offset, 2 * length, headerLength)\n if (!_temp) return null\n const [ result, consumedBytes ] = _temp\n\n var isPlainObject = !options.preferMap\n\n if (isPlainObject) {\n for (let i = 0; i < 2 * length; i += 2) {\n if (typeof result[i] !== 'string') {\n isPlainObject = false\n break\n }\n }\n }\n\n if (isPlainObject) {\n const object = {}\n for (let i = 0; i < 2 * length; i += 2) {\n const key = result[i]\n const val = result[i + 1]\n\n if (key === '__proto__') {\n if (options.protoAction === 'error') {\n throw new SyntaxError('Object contains forbidden prototype property')\n }\n\n if (options.protoAction === 'remove') {\n continue\n }\n }\n\n object[key] = val\n }\n return [object, consumedBytes]\n } else {\n const mapping = new Map()\n for (let i = 0; i < 2 * length; i += 2) {\n const key = result[i]\n const val = result[i + 1]\n mapping.set(key, val)\n }\n return [mapping, consumedBytes]\n }\n }", "label": 1, "label_name": "safe"} -{"code": "inline TfLiteStatus EvalImpl(TfLiteContext* context, TfLiteNode* node,\n std::function func,\n TfLiteType expected_type) {\n const TfLiteTensor* input;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 0, &input));\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, 0, &output));\n TF_LITE_ENSURE_TYPES_EQ(context, input->type, expected_type);\n const int64_t num_elements = NumElements(input);\n const T* in_data = GetTensorData(input);\n T* out_data = GetTensorData(output);\n for (int64_t i = 0; i < num_elements; ++i) {\n out_data[i] = func(in_data[i]);\n }\n return kTfLiteOk;\n}", "label": 1, "label_name": "safe"} -{"code": "this.spacing=0}function Ca(){mxArrowConnector.call(this);this.spacing=0}function Qa(){mxActor.call(this)}function Ta(){mxRectangleShape.call(this)}function Ka(){mxActor.call(this)}function bb(){mxActor.call(this)}function Ua(){mxActor.call(this)}function $a(){mxActor.call(this)}function z(){mxActor.call(this)}function L(){mxActor.call(this)}function M(){mxActor.call(this)}function T(){mxActor.call(this)}function ca(){mxActor.call(this)}function ia(){mxActor.call(this)}function ma(){mxEllipse.call(this)}", "label": 1, "label_name": "safe"} -{"code": " def to_xml(self, data, options=None):\n \"\"\"\n Given some Python data, produces XML output.\n \"\"\"\n options = options or {}\n \n if lxml is None:\n raise ImproperlyConfigured(\"Usage of the XML aspects requires lxml.\")\n \n return tostring(self.to_etree(data, options), xml_declaration=True, encoding='utf-8')", "label": 0, "label_name": "vulnerable"} -{"code": "\tprivate function setModule($value)\n\t{\n\t\t$modules = (array) FrontendModel::getModules();\n\t\t\n\t\tif(!in_array((string) $value, $modules))\n\t\t{\n\t\t\t// when debug is on throw an exception\n\t\t\tif(SPOON_DEBUG) throw new FrontendException('Invalid file.');\n\n\t\t\t// when debug is of show a descent message\n\t\t\telse exit(SPOON_DEBUG_MESSAGE);\n\t\t}\n\t\t\n\t\t$this->module = (string) $value;\n\t}", "label": 1, "label_name": "safe"} -{"code": "this.addMenuItems(O,[\"copyAsImage\"],null,ea)};EditorUi.prototype.toggleFormatPanel=function(O){null!=this.formatWindow?this.formatWindow.window.setVisible(null!=O?O:!this.formatWindow.window.isVisible()):b(this)};DiagramFormatPanel.prototype.isMathOptionVisible=function(){return!0};var G=EditorUi.prototype.destroy;EditorUi.prototype.destroy=function(){null!=this.sidebarWindow&&(this.sidebarWindow.window.setVisible(!1),this.sidebarWindow.window.destroy(),this.sidebarWindow=null);null!=this.formatWindow&&\n(this.formatWindow.window.setVisible(!1),this.formatWindow.window.destroy(),this.formatWindow=null);null!=this.actions.outlineWindow&&(this.actions.outlineWindow.window.setVisible(!1),this.actions.outlineWindow.window.destroy(),this.actions.outlineWindow=null);null!=this.actions.layersWindow&&(this.actions.layersWindow.window.setVisible(!1),this.actions.layersWindow.destroy(),this.actions.layersWindow=null);null!=this.menus.tagsWindow&&(this.menus.tagsWindow.window.setVisible(!1),this.menus.tagsWindow.window.destroy(),\nthis.menus.tagsWindow=null);null!=this.menus.findWindow&&(this.menus.findWindow.window.setVisible(!1),this.menus.findWindow.window.destroy(),this.menus.findWindow=null);null!=this.menus.findReplaceWindow&&(this.menus.findReplaceWindow.window.setVisible(!1),this.menus.findReplaceWindow.window.destroy(),this.menus.findReplaceWindow=null);G.apply(this,arguments)};var aa=EditorUi.prototype.setGraphEnabled;EditorUi.prototype.setGraphEnabled=function(O){aa.apply(this,arguments);if(O){var X=window.innerWidth||", "label": 0, "label_name": "vulnerable"} -{"code": "static ssize_t aio_setup_single_vector(struct kiocb *kiocb,\n\t\t\t\t int rw, char __user *buf,\n\t\t\t\t unsigned long *nr_segs,\n\t\t\t\t size_t len,\n\t\t\t\t struct iovec *iovec)\n{\n\tif (unlikely(!access_ok(!rw, buf, len)))\n\t\treturn -EFAULT;\n\n\tiovec->iov_base = buf;\n\tiovec->iov_len = len;\n\t*nr_segs = 1;\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function autoFinalize() {\n if ($this->autoFinalize) {\n $this->finalize();\n } else {\n $this->plist->squash(true);\n }\n }", "label": 1, "label_name": "safe"} -{"code": " public function __construct($type) {\n $this->type = $type;\n }", "label": 1, "label_name": "safe"} -{"code": " public function showByTitle() {\n expHistory::set('viewable', $this->params);\n $modelname = $this->basemodel_name;\n // first we'll check to see if this matches the sef_url field...if not then we'll look for the\n // title field\n $this->params['title'] = expString::escape($this->params['title']); // escape title to prevent sql injection\n $record = $this->$modelname->find('first', \"sef_url='\" . $this->params['title'] . \"'\");\n if (!is_object($record)) {\n $record = $this->$modelname->find('first', \"title='\" . $this->params['title'] . \"'\");\n }\n $this->loc = unserialize($record->location_data);\n\n assign_to_template(array(\n 'record' => $record,\n ));\n }", "label": 1, "label_name": "safe"} -{"code": " public function testCreateServiceClass()\n {\n $builder = new ContainerBuilder();\n $builder->register('foo1', '%class%');\n $builder->setParameter('class', 'stdClass');\n $this->assertInstanceOf('\\stdClass', $builder->get('foo1'), '->createService() replaces parameters in the class provided by the service definition');\n }", "label": 0, "label_name": "vulnerable"} -{"code": "mxText.prototype.updateValue=function(){if(mxUtils.isNode(this.value))this.node.innerHTML=\"\",this.node.appendChild(this.value);else{var a=this.value;this.dialect!=mxConstants.DIALECT_STRICTHTML&&(a=mxUtils.htmlEntities(a,!1));a=mxUtils.replaceTrailingNewlines(a,\"

\");a=this.replaceLinefeeds?a.replace(/\\n/g,\"
\"):a;var b=null!=this.background&&this.background!=mxConstants.NONE?this.background:null,c=null!=this.border&&this.border!=mxConstants.NONE?this.border:null;if(\"fill\"==this.overflow||\n\"width\"==this.overflow)null!=b&&(this.node.style.backgroundColor=b),null!=c&&(this.node.style.border=\"1px solid \"+c);else{var d=\"\";null!=b&&(d+=\"background-color:\"+mxUtils.htmlEntities(b)+\";\");null!=c&&(d+=\"border:1px solid \"+mxUtils.htmlEntities(c)+\";\");a='
'+a+\"
\"}this.node.innerHTML=\na;a=this.node.getElementsByTagName(\"div\");0b-a;c--)if(this._.tabs[this._.tabIdList[c%a]][0].$.offsetHeight)return this._.tabIdList[c%a];return null}function u(){for(var a=this._.tabIdList.length,b=CKEDITOR.tools.indexOf(this._.tabIdList,this._.currentTabId),c=b+1;cparams['id'])) {\n\t\t\t$vendor = $vendor->find('first', 'id =' .$this->params['id']);\n\t\t\tassign_to_template(array(\n 'vendor'=>$vendor\n ));\n\t\t}\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": "def delete_access(request, pk):\n topic_private = TopicPrivate.objects.for_delete_or_404(pk, request.user)\n\n if request.method == 'POST':\n topic_private.delete()\n\n if request.user.pk == topic_private.user_id:\n return redirect(reverse(\"spirit:topic:private:index\"))\n\n return redirect(request.POST.get('next', topic_private.get_absolute_url()))\n\n return render(\n request=request,\n template_name='spirit/topic/private/delete.html',\n context={'topic_private': topic_private})", "label": 0, "label_name": "vulnerable"} -{"code": "(function(){function y(a){for(var a=a.toUpperCase(),c=z.length,b=0,f=0;ftype = R_BIN_JAVA_ATTR_TYPE_RUNTIME_VISIBLE_ANNOTATION_ATTR;\n\t\tattr->info.annotation_array.num_annotations = R_BIN_JAVA_USHORT (buffer, offset);\n\t\toffset += 2;\n\t\tattr->info.annotation_array.annotations = r_list_newf (r_bin_java_annotation_free);\n\t\tfor (i = 0; i < attr->info.annotation_array.num_annotations; i++) {\n\t\t\tif (offset >= sz) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tRBinJavaAnnotation *annotation = r_bin_java_annotation_new (buffer + offset, sz - offset, buf_offset + offset);\n\t\t\tif (annotation) {\n\t\t\t\toffset += annotation->size;\n\t\t\t\tr_list_append (attr->info.annotation_array.annotations, (void *) annotation);\n\t\t\t}\n\t\t}\n\t\tattr->size = offset;\n\t}\n\treturn attr;\n}", "label": 1, "label_name": "safe"} -{"code": "TEST_F(AsStringGraphTest, FillWithChar1) {\n TF_ASSERT_OK(Init(DT_INT64, /*fill=*/\"-\", /*width=*/4));\n\n AddInputFromArray(TensorShape({3}), {-42, 0, 42});\n TF_ASSERT_OK(RunOpKernel());\n Tensor expected(allocator(), DT_STRING, TensorShape({3}));\n test::FillValues(&expected, {\"-42 \", \"0 \", \"42 \"});\n test::ExpectTensorEqual(expected, *GetOutput(0));\n}", "label": 1, "label_name": "safe"} -{"code": "function singleQuoteReplace($param1 = false, $param2 = false, $param3)\n{\n return str_replace(\"'\", \"''\", str_replace(\"\\'\", \"'\", $param3));\n}", "label": 0, "label_name": "vulnerable"} -{"code": "static bool tls_desc_okay(const struct user_desc *info)\n{\n\tif (LDT_empty(info))\n\t\treturn true;\n\n\t/*\n\t * espfix is required for 16-bit data segments, but espfix\n\t * only works for LDT segments.\n\t */\n\tif (!info->seg_32bit)\n\t\treturn false;\n\n\treturn true;\n}", "label": 1, "label_name": "safe"} -{"code": " public function approve() {\n expHistory::set('editable', $this->params);\n\n /* The global constants can be overriden by passing appropriate params */\n //sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet\n $require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];\n $require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];\n $require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];\n $notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];\n\n if (empty($this->params['id'])) {\n flash('error', gt('No ID supplied for note to approve'));\n $lastUrl = expHistory::getLast('editable');\n }\n\n $simplenote = new expSimpleNote($this->params['id']);\n assign_to_template(array(\n 'simplenote'=>$simplenote,\n 'require_login'=>$require_login,\n 'require_approval'=>$require_approval,\n 'require_notification'=>$require_notification,\n 'notification_email'=>$notification_email,\n 'tab'=>$this->params['tab']\n ));\n }", "label": 1, "label_name": "safe"} -{"code": "vrrp_print_data(void)\n{\n\tFILE *file = fopen_safe(dump_file, \"w\");\n\n\tif (!file) {\n\t\tlog_message(LOG_INFO, \"Can't open %s (%d: %s)\",\n\t\t\tdump_file, errno, strerror(errno));\n\t\treturn;\n\t}\n\n\tdump_data_vrrp(file);\n\n\tfclose(file);\n}", "label": 1, "label_name": "safe"} -{"code": "module.exports.checkout = function (callback) {\n cp.exec(gitApp + ' checkout -- .', gitExtra, callback);\n};", "label": 0, "label_name": "vulnerable"} -{"code": "int sc_file_set_sec_attr(sc_file_t *file, const u8 *sec_attr,\n\t\t\t size_t sec_attr_len)\n{\n\tu8 *tmp;\n\tif (!sc_file_valid(file)) {\n\t\treturn SC_ERROR_INVALID_ARGUMENTS;\n\t}\n\n\tif (sec_attr == NULL) {\n\t\tif (file->sec_attr != NULL)\n\t\t\tfree(file->sec_attr);\n\t\tfile->sec_attr = NULL;\n\t\tfile->sec_attr_len = 0;\n\t\treturn 0;\n\t }\n\ttmp = (u8 *) realloc(file->sec_attr, sec_attr_len);\n\tif (!tmp) {\n\t\tif (file->sec_attr)\n\t\t\tfree(file->sec_attr);\n\t\tfile->sec_attr = NULL;\n\t\tfile->sec_attr_len = 0;\n\t\treturn SC_ERROR_OUT_OF_MEMORY;\n\t}\n\tfile->sec_attr = tmp;\n\tmemcpy(file->sec_attr, sec_attr, sec_attr_len);\n\tfile->sec_attr_len = sec_attr_len;\n\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "process_bitmap_updates(STREAM s)\n{\n\tint i;\n\tuint16 num_updates;\n\t\n\tin_uint16_le(s, num_updates); /* rectangles */\n\n\tfor (i = 0; i < num_updates; i++)\n\t{\n\t\tprocess_bitmap_data(s);\n\t}\n}", "label": 1, "label_name": "safe"} -{"code": "static void parseLanguages(HttpRoute *route, cchar *key, MprJson *prop)\n{\n MprJson *child;\n cchar *path, *prefix, *suffix;\n int ji;\n\n for (ITERATE_CONFIG(route, prop, child, ji)) {\n if ((prefix = mprReadJson(child, \"prefix\")) != 0) {\n httpAddRouteLanguageSuffix(route, child->name, child->value, HTTP_LANG_BEFORE);\n }\n if ((suffix = mprReadJson(child, \"suffix\")) != 0) {\n httpAddRouteLanguageSuffix(route, child->name, child->value, HTTP_LANG_AFTER);\n }\n if ((path = mprReadJson(child, \"path\")) != 0) {\n httpAddRouteLanguageDir(route, child->name, mprGetAbsPath(path));\n }\n if (smatch(mprReadJson(child, \"default\"), \"default\")) {\n httpSetRouteDefaultLanguage(route, child->name);\n }\n }\n}", "label": 1, "label_name": "safe"} -{"code": " protected function getNewShopUrl(Request $request, Shop $newShop)\n {\n // Remove baseUrl from request url\n $url = $request->getRequestUri();\n\n $requestShop = $this->get(ModelManager::class)->getRepository(Shop::class)->getActiveShopByRequestAsArray($request);\n if ($requestShop && str_starts_with($url, $requestShop['base_url'])) {\n $url = substr($url, \\strlen($requestShop['base_url']));\n }\n\n $baseUrl = $request->getBaseUrl();\n if (str_starts_with($url, $baseUrl . '/')) {\n $url = substr($url, \\strlen($baseUrl));\n }\n\n $basePath = (string) $newShop->getBasePath();\n if (str_starts_with($url, $basePath)) {\n $url = substr($url, \\strlen($basePath));\n }\n\n $host = $newShop->getHost();\n $baseUrl = $newShop->getBaseUrl() ?: $request->getBasePath();\n\n if ($request->isSecure()) {\n if ($newShop->getBaseUrl()) {\n $baseUrl = $newShop->getBaseUrl();\n } else {\n $baseUrl = $request->getBaseUrl();\n }\n }\n\n if (\\is_string($host)) {\n $host = trim($host, '/');\n }\n if (\\is_string($baseUrl)) {\n $baseUrl = trim($baseUrl, '/');\n }\n if (!empty($baseUrl)) {\n $baseUrl = '/' . $baseUrl;\n }\n\n $url = ltrim($url, '/');\n if (!empty($url)) {\n $url = '/' . $url;\n }\n\n //build full redirect url to allow host switches\n return sprintf(\n '%s://%s%s%s',\n $request->getScheme(),\n $host,\n $baseUrl,\n $url\n );\n }", "label": 1, "label_name": "safe"} -{"code": "this.graph.getTooltip(c,d,e,f);this.show(k,e,f);this.state=c;this.node=d;this.stateSource=g}}),this.delay)}};mxTooltipHandler.prototype.hide=function(){this.resetTimer();this.hideTooltip()};mxTooltipHandler.prototype.hideTooltip=function(){null!=this.div&&(this.div.style.visibility=\"hidden\",this.div.innerHTML=\"\")};", "label": 0, "label_name": "vulnerable"} -{"code": "static void numtostr(js_State *J, const char *fmt, int w, double n)\n{\n\tchar buf[32], *e;\n\tsprintf(buf, fmt, w, n);\n\te = strchr(buf, 'e');\n\tif (e) {\n\t\tint exp = atoi(e+1);\n\t\tsprintf(e, \"e%+d\", exp);\n\t}\n\tjs_pushstring(J, buf);\n}", "label": 0, "label_name": "vulnerable"} -{"code": " internal static bool ValidateHeaders( \n KeyValuePair>[] requestHeaders, \n string cookieToken,\n out string failedReason)\n {\n failedReason = \"\";\n\n if (requestHeaders.Any(z => z.Key.InvariantEquals(AngularHeadername)) == false)\n {\n failedReason = \"Missing token\";\n return false;\n }\n\n var headerToken = requestHeaders\n .Where(z => z.Key.InvariantEquals(AngularHeadername))\n .Select(z => z.Value)\n .SelectMany(z => z)\n .FirstOrDefault();\n \n // both header and cookie must be there\n if (cookieToken == null || headerToken == null)\n {\n failedReason = \"Missing token null\";\n return false;\n }\n\n if (ValidateTokens(cookieToken, headerToken) == false)\n {\n failedReason = \"Invalid token\";\n return false;\n }\n\n return true;\n }", "label": 1, "label_name": "safe"} -{"code": " public function testEmptyInput()\n {\n $this->assertResult('', false);\n }", "label": 1, "label_name": "safe"} -{"code": "static int ocfs2_lock_get_block(struct inode *inode, sector_t iblock,\n\t\t struct buffer_head *bh_result, int create)\n{\n\tint ret = 0;\n\tstruct ocfs2_inode_info *oi = OCFS2_I(inode);\n\n\tdown_read(&oi->ip_alloc_sem);\n\tret = ocfs2_get_block(inode, iblock, bh_result, create);\n\tup_read(&oi->ip_alloc_sem);\n\n\treturn ret;\n}", "label": 1, "label_name": "safe"} -{"code": " public function __construct($parent = null) {\n $this->parent = $parent;\n }", "label": 1, "label_name": "safe"} -{"code": " public function renderRequest()\n {\n $request = '';\n foreach ($this->displayVars as $name) {\n if (!empty($GLOBALS[$name])) {\n $request .= '$' . $name . ' = ' . VarDumper::export($GLOBALS[$name]) . \";\\n\\n\";\n }\n }\n\n return '
' . $this->htmlEncode(rtrim($request, \"\\n\")) . '
';\n }", "label": 1, "label_name": "safe"} -{"code": " def __init__(self, formats=None, content_types=None, datetime_formatting=None):\n self.supported_formats = []\n self.datetime_formatting = getattr(settings, 'TASTYPIE_DATETIME_FORMATTING', 'iso-8601')\n\n if formats is not None:\n self.formats = formats\n\n if content_types is not None:\n self.content_types = content_types\n\n if datetime_formatting is not None:\n self.datetime_formatting = datetime_formatting\n\n for format in self.formats:\n try:\n self.supported_formats.append(self.content_types[format])\n except KeyError:\n raise ImproperlyConfigured(\"Content type for specified type '%s' not found. Please provide it at either the class level or via the arguments.\" % format)", "label": 1, "label_name": "safe"} -{"code": "def make_sydent(test_config={}):\n \"\"\"Create a new sydent\n\n Args:\n test_config (dict): any configuration variables for overriding the default sydent\n config\n \"\"\"\n # Use an in-memory SQLite database. Note that the database isn't cleaned up between\n # tests, so by default the same database will be used for each test if changed to be\n # a file on disk.\n if 'db' not in test_config:\n test_config['db'] = {'db.file': ':memory:'}\n else:\n test_config['db'].setdefault('db.file', ':memory:')\n\n reactor = MemoryReactorClock()\n return Sydent(reactor=reactor, cfg=parse_config_dict(test_config))", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic static function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) {\n\t\t$config = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'globalnewfiles' );\n\n\t\tif ( $config->get( 'CreateWikiDatabase' ) === $config->get( 'DBname' ) ) {\n\t\t\t$updater->addExtensionTable(\n\t\t\t\t'gnf_files',\n\t\t\t\t__DIR__ . '/../sql/gnf_files.sql'\n\t\t\t);\n\n\t\t\t$updater->modifyExtensionField(\n\t\t\t\t'gnf_files',\n\t\t\t\t'files_timestamp',\n\t\t\t\t__DIR__ . '/../sql/patches/patch-gnf_files-binary.sql'\n\t\t\t);\n\n\t\t\t$updater->modifyTable(\n \t\t\t\t'gnf_files',\n \t\t\t\t__DIR__ . '/../sql/patches/patch-gnf_files-add-indexes.sql',\n\t\t\t\ttrue\n \t\t\t);\n\t\t}\n\n\t\treturn true;\n\t}", "label": 1, "label_name": "safe"} -{"code": "Status GetInitOp(const string& export_dir, const MetaGraphDef& meta_graph_def,\n string* init_op_name) {\n const auto& sig_def_map = meta_graph_def.signature_def();\n const auto& init_op_sig_it =\n meta_graph_def.signature_def().find(kSavedModelInitOpSignatureKey);\n if (init_op_sig_it != sig_def_map.end()) {\n const auto& sig_def_outputs = init_op_sig_it->second.outputs();\n const auto& sig_def_outputs_it =\n sig_def_outputs.find(kSavedModelInitOpSignatureKey);\n if (sig_def_outputs_it == sig_def_outputs.end()) {\n return errors::FailedPrecondition(\"Could not find output \",\n kSavedModelInitOpSignatureKey);\n }\n *init_op_name = sig_def_outputs_it->second.name();\n return Status::OK();\n }\n\n const auto& collection_def_map = meta_graph_def.collection_def();\n string init_op_collection_key;\n if (collection_def_map.find(kSavedModelMainOpKey) !=\n collection_def_map.end()) {\n init_op_collection_key = kSavedModelMainOpKey;\n } else {\n init_op_collection_key = kSavedModelLegacyInitOpKey;\n }\n\n const auto init_op_it = collection_def_map.find(init_op_collection_key);\n if (init_op_it != collection_def_map.end()) {\n if (init_op_it->second.node_list().value_size() != 1) {\n return errors::FailedPrecondition(\n strings::StrCat(\"Expected exactly one main op in : \", export_dir));\n }\n *init_op_name = init_op_it->second.node_list().value(0);\n }\n return Status::OK();\n}", "label": 1, "label_name": "safe"} -{"code": " value = value.replace(/src=\" *javascript\\:(.*?)\"/gi, function(m, $1) {\n return 'removed=\"\"';\n });", "label": 1, "label_name": "safe"} -{"code": "fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc)\n{\n\ttmsize_t stride = PredictorState(tif)->stride;\n\tuint32 bps = tif->tif_dir.td_bitspersample / 8;\n\ttmsize_t wc = cc / bps;\n\ttmsize_t count;\n\tuint8 *cp = (uint8 *) cp0;\n\tuint8 *tmp;\n\n if((cc%(bps*stride))!=0)\n {\n TIFFErrorExt(tif->tif_clientdata, \"fpDiff\",\n \"%s\", \"(cc%(bps*stride))!=0\");\n return 0;\n }\n\n tmp = (uint8 *)_TIFFmalloc(cc);\n\tif (!tmp)\n\t\treturn 0;\n\n\t_TIFFmemcpy(tmp, cp0, cc);\n\tfor (count = 0; count < wc; count++) {\n\t\tuint32 byte;\n\t\tfor (byte = 0; byte < bps; byte++) {\n\t\t\t#if WORDS_BIGENDIAN\n\t\t\tcp[byte * wc + count] = tmp[bps * count + byte];\n\t\t\t#else\n\t\t\tcp[(bps - byte - 1) * wc + count] =\n\t\t\t\ttmp[bps * count + byte];\n\t\t\t#endif\n\t\t}\n\t}\n\t_TIFFfree(tmp);\n\n\tcp = (uint8 *) cp0;\n\tcp += cc - stride - 1;\n\tfor (count = cc; count > stride; count -= stride)\n\t\tREPEAT4(stride, cp[stride] = (unsigned char)((cp[stride] - cp[0])&0xff); cp--)\n return 1;\n}", "label": 1, "label_name": "safe"} -{"code": " it { should be_enabled }", "label": 0, "label_name": "vulnerable"} -{"code": " public function updateForgottenPassword(array $input) {\n $condition = [\n 'glpi_users.is_active' => 1,\n 'glpi_users.is_deleted' => 0, [\n 'OR' => [\n ['glpi_users.begin_date' => null],\n ['glpi_users.begin_date' => ['<', new QueryExpression('NOW()')]]\n ],\n ], [\n 'OR' => [\n ['glpi_users.end_date' => null],\n ['glpi_users.end_date' => ['>', new QueryExpression('NOW()')]]\n ]\n ]\n ];\n if ($this->getFromDBbyEmail($input['email'], $condition)) {\n if (($this->fields[\"authtype\"] == Auth::DB_GLPI)\n || !Auth::useAuthExt()) {\n\n if (($input['password_forget_token'] == $this->fields['password_forget_token'])\n && (abs(strtotime($_SESSION[\"glpi_currenttime\"])\n -strtotime($this->fields['password_forget_token_date'])) < DAY_TIMESTAMP)) {\n\n $input['id'] = $this->fields['id'];\n Config::validatePassword($input[\"password\"], false); // Throws exception if password is invalid\n if (!$this->update($input)) {\n return false;\n }\n $input2 = [\n 'password_forget_token' => '',\n 'password_forget_token_date' => null,\n 'id' => $this->fields['id']\n ];\n $this->update($input2);\n return true;\n\n } else {\n throw new ForgetPasswordException(__('Your password reset request has expired or is invalid. Please renew it.'));\n }\n\n } else {\n throw new ForgetPasswordException(__(\"The authentication method configuration doesn't allow you to change your password.\"));\n }\n\n } else {\n throw new ForgetPasswordException(__('Email address not found.'));\n }\n\n return false;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " it 'returns false' do\n provider.class.stubs(:mongo).returns(< INT_MAX) {\n\t\t/* string length is int in 5.x so we can not read more than int */\n\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"Length parameter must be no more than %d\", INT_MAX);\n\t\tRETURN_FALSE;\n\t}\n\n\tZ_STRVAL_P(return_value) = emalloc(len + 1);\n\tZ_STRLEN_P(return_value) = php_stream_read(stream, Z_STRVAL_P(return_value), len);\n\n\t/* needed because recv/read/gzread doesnt put a null at the end*/\n\tZ_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;\n\tZ_TYPE_P(return_value) = IS_STRING;\n}", "label": 1, "label_name": "safe"} -{"code": " public function setFile($file)\n {\n $this->changes['file'] = true;\n\n return parent::setFile($file);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "transientObjectPutErrorMessage(Runtime *runtime, Handle<> base, SymbolID id) {\n // Emit an error message that looks like:\n // \"Cannot create property '%{id}' on ${typeof base} '${String(base)}'\".\n StringView propName =\n runtime->getIdentifierTable().getStringView(runtime, id);\n Handle baseType =\n runtime->makeHandle(vmcast(typeOf(runtime, base)));\n StringView baseTypeAsString =\n StringPrimitive::createStringView(runtime, baseType);\n MutableHandle valueAsString{runtime};\n if (base->isSymbol()) {\n // Special workaround for Symbol which can't be stringified.\n auto str = symbolDescriptiveString(runtime, Handle::vmcast(base));\n if (str != ExecutionStatus::EXCEPTION) {\n valueAsString = *str;\n } else {\n runtime->clearThrownValue();\n valueAsString = StringPrimitive::createNoThrow(\n runtime, \"<>\");\n }\n } else {\n auto str = toString_RJS(runtime, base);\n assert(\n str != ExecutionStatus::EXCEPTION &&\n \"Primitives should be convertible to string without exceptions\");\n valueAsString = std::move(*str);\n }\n StringView valueAsStringPrintable =\n StringPrimitive::createStringView(runtime, valueAsString);\n\n SmallU16String<32> tmp;\n return runtime->raiseTypeError(\n TwineChar16(\"Cannot create property '\") + propName + \"' on \" +\n baseTypeAsString.getUTF16Ref(tmp) + \" '\" +\n valueAsStringPrintable.getUTF16Ref(tmp) + \"'\");\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function testSanitizeDde(string $input)\n {\n self::assertEquals(\"' \" . $input, StringHelper::sanitizeDDE($input));\n }", "label": 1, "label_name": "safe"} -{"code": "pidfile_write(const char *pid_file, int pid)\n{\n\tFILE *pidfile = NULL;\n\tint pidfd = open(pid_file, O_NOFOLLOW | O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);\n\n\tif (pidfd != -1) pidfile = fdopen(pidfd, \"w\");\n\n\tif (!pidfile) {\n\t\tlog_message(LOG_INFO, \"pidfile_write : Cannot open %s pidfile\",\n\t\t pid_file);\n\t\treturn 0;\n\t}\n\tfprintf(pidfile, \"%d\\n\", pid);\n\tfclose(pidfile);\n\treturn 1;\n}", "label": 1, "label_name": "safe"} -{"code": " function process_subsections($parent_section, $subtpl) {\n global $db, $router;\n\n $section = new stdClass();\n $section->parent = $parent_section->id;\n $section->name = $subtpl->name;\n $section->sef_name = $router->encode($section->name);\n $section->subtheme = $subtpl->subtheme;\n $section->active = $subtpl->active;\n $section->public = $subtpl->public;\n $section->rank = $subtpl->rank;\n $section->page_title = $subtpl->page_title;\n $section->keywords = $subtpl->keywords;\n $section->description = $subtpl->description;\n $section->id = $db->insertObject($section, 'section');\n self::process_section($section, $subtpl);\n }", "label": 1, "label_name": "safe"} -{"code": " render() {},", "label": 1, "label_name": "safe"} -{"code": " public function validate() {\n global $db;\n // check for an sef url field. If it exists make sure it's valid and not a duplicate\n //this needs to check for SEF URLS being turned on also: TODO\n\n if (property_exists($this, 'sef_url') && !(in_array('sef_url', $this->do_not_validate))) {\n if (empty($this->sef_url)) $this->makeSefUrl();\n if (!isset($this->validates['is_valid_sef_name']['sef_url'])) $this->validates['is_valid_sef_name']['sef_url'] = array();\n if (!isset($this->validates['uniqueness_of']['sef_url'])) $this->validates['uniqueness_of']['sef_url'] = array();\n }\n\n // safeguard again loc data not being pass via forms...sometimes this happens when you're in a router\n // mapped view and src hasn't been passed in via link to the form \n if (isset($this->id) && empty($this->location_data)) {\n $loc = $db->selectValue($this->tablename, 'location_data', 'id=' . $this->id);\n if (!empty($loc)) $this->location_data = $loc;\n }\n\n // run the validation as defined in the models\n if (!isset($this->validates)) return true;\n $messages = array();\n $post = empty($_POST) ? array() : expString::sanitize($_POST);\n foreach ($this->validates as $validation=> $field) {\n foreach ($field as $key=> $value) {\n $fieldname = is_numeric($key) ? $value : $key;\n $opts = is_numeric($key) ? array() : $value;\n $ret = expValidator::$validation($fieldname, $this, $opts);\n if (!is_bool($ret)) {\n $messages[] = $ret;\n expValidator::setErrorField($fieldname);\n unset($post[$fieldname]);\n }\n }\n }\n\n if (count($messages) >= 1) expValidator::failAndReturnToForm($messages, $post);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "func (m *MockRequester) GetRequestedAt() time.Time {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetRequestedAt\")\n\tret0, _ := ret[0].(time.Time)\n\treturn ret0\n}", "label": 1, "label_name": "safe"} -{"code": "function ma(na,Ja,Ga){if(null!=na&&mxUtils.isAncestorNode(document.body,ca)&&(na=mxUtils.parseXml(na),na=Editor.extractGraphModel(na.documentElement,!0),null!=na)){\"mxfile\"==na.nodeName&&(na=Editor.parseDiagramNode(na.getElementsByTagName(\"diagram\")[0]));var Ra=new mxCodec(na.ownerDocument),Sa=new mxGraphModel;Ra.decode(na,Sa);na=Sa.root.getChildAt(0).children||[];b.sidebar.createTooltip(ca,na,Math.min((window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)-80,1E3),Math.min((window.innerHeight||\ndocument.documentElement.clientHeight||document.body.clientHeight)-80,800),null!=fa.title?mxResources.get(fa.title,null,fa.title):null,!0,new mxPoint(Ja,Ga),!0,null,!0);var Ha=document.createElement(\"div\");Ha.className=\"geTempDlgDialogMask\";Q.appendChild(Ha);var Na=b.sidebar.hideTooltip;b.sidebar.hideTooltip=function(){Ha&&(Q.removeChild(Ha),Ha=null,Na.apply(this,arguments),b.sidebar.hideTooltip=Na)};mxEvent.addListener(Ha,\"click\",function(){b.sidebar.hideTooltip()})}}var qa=null;if(Ca||b.sidebar.currentElt==", "label": 1, "label_name": "safe"} -{"code": " $dbfield = $this->GetFieldFromProp(str_replace(\"_IsEmpty\", \"\", $prop));\n $this->_where .= $this->_where_delim . \" \" . $dbfield . \" = ''\";\n $this->_where_delim = \" and\";\n } elseif (substr($prop, - 11) == \"_IsNotEmpty\" && $this->$prop ?? '') {", "label": 1, "label_name": "safe"} -{"code": "void snd_usb_mixer_disconnect(struct usb_mixer_interface *mixer)\n{\n\tusb_kill_urb(mixer->urb);\n\tusb_kill_urb(mixer->rc_urb);\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function generateChildDefCallback($matches) {\n return $this->info[$matches[0]];\n }", "label": 1, "label_name": "safe"} -{"code": "def test_query_customer_user(\n staff_api_client,\n customer_user,\n gift_card_used,\n gift_card_expiry_date,\n address,\n permission_manage_users,\n permission_manage_orders,\n media_root,\n settings,", "label": 1, "label_name": "safe"} -{"code": "\t\theader: function(elem){\n\t\t\treturn /h\\d/i.test( elem.nodeName );\n\t\t},", "label": 0, "label_name": "vulnerable"} -{"code": "static void vmx_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu)\n{\n\tstruct vcpu_vmx *vmx = to_vmx(vcpu);\n\n\tvmcs_write32(PIN_BASED_VM_EXEC_CONTROL, vmx_pin_based_exec_ctrl(vmx));\n\tif (cpu_has_secondary_exec_ctrls()) {\n\t\tif (kvm_vcpu_apicv_active(vcpu))\n\t\t\tvmcs_set_bits(SECONDARY_VM_EXEC_CONTROL,\n\t\t\t\t SECONDARY_EXEC_APIC_REGISTER_VIRT |\n\t\t\t\t SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY);\n\t\telse\n\t\t\tvmcs_clear_bits(SECONDARY_VM_EXEC_CONTROL,\n\t\t\t\t\tSECONDARY_EXEC_APIC_REGISTER_VIRT |\n\t\t\t\t\tSECONDARY_EXEC_VIRTUAL_INTR_DELIVERY);\n\t}\n\n\tif (cpu_has_vmx_msr_bitmap())\n\t\tvmx_set_msr_bitmap(vcpu);\n}", "label": 1, "label_name": "safe"} -{"code": " public function getUserList()\n {\n $result = [];\n $users = CodeModel::all(User::tableName(), 'nick', 'nick', false);\n foreach ($users as $codeModel) {\n if ($codeModel->code != 'admin') {\n $result[$codeModel->code] = $codeModel->description;\n }\n }\n\n return $result;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "elFinder.prototype.commands.copy = function() {\n\t\n\tthis.shortcuts = [{\n\t\tpattern : 'ctrl+c ctrl+insert'\n\t}];\n\t\n\tthis.getstate = function(sel) {\n\t\tvar sel = this.files(sel),\n\t\t\tcnt = sel.length;\n\n\t\treturn cnt && $.map(sel, function(f) { return f.phash && f.read ? f : null }).length == cnt ? 0 : -1;\n\t}\n\t\n\tthis.exec = function(hashes) {\n\t\tvar fm = this.fm,\n\t\t\tdfrd = $.Deferred()\n\t\t\t\t.fail(function(error) {\n\t\t\t\t\tfm.error(error);\n\t\t\t\t});\n\n\t\t$.each(this.files(hashes), function(i, file) {\n\t\t\tif (!(file.read && file.phash)) {\n\t\t\t\treturn !dfrd.reject(['errCopy', file.name, 'errPerm']);\n\t\t\t}\n\t\t});\n\t\t\n\t\treturn dfrd.state() == 'rejected' ? dfrd : dfrd.resolve(fm.clipboard(this.hashes(hashes)));\n\t}\n\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public static function go($input, $path, $allowed='', $uniq=false, $size='', $width = '', $height = ''){\r\n $filename = Typo::cleanX($_FILES[$input]['name']);\r\n $filename = str_replace(' ', '_', $filename);\r\n if(isset($_FILES[$input]) && $_FILES[$input]['error'] == 0){\r\n if($uniq == true){\r\n $site = Typo::slugify(Options::v('sitename'));\r\n $uniqfile = $site.'-'.sha1(microtime().$filename).'-';\r\n }else{\r\n $uniqfile = '';\r\n }\r\n \r\n $extension = pathinfo($_FILES[$input]['name'], PATHINFO_EXTENSION);\r\n $filetmp = $_FILES[$input]['tmp_name'];\r\n $filepath = GX_PATH.$path.$uniqfile.$filename;\r\n\r\n if(!in_array(strtolower($extension), $allowed)){\r\n $result['error'] = 'File not allowed';\r\n }else{\r\n if(move_uploaded_file(\r\n $filetmp, \r\n $filepath)\r\n ){\r\n $result['filesize'] = filesize($filepath);\r\n $result['filename'] = $uniqfile.$filename;\r\n $result['path'] = $path.$uniqfile.$filename;\r\n $result['filepath'] = $filepath;\r\n $result['fileurl'] = Site::$url.$path.$uniqfile.$filename;\r\n\r\n }else{\r\n $result['error'] = 'Cannot upload to directory, please check \r\n if directory is exist or You had permission to write it.';\r\n }\r\n }\r\n\r\n \r\n }else{\r\n //$result['error'] = $_FILES[$input]['error'];\r\n $result['error'] = '';\r\n }\r\n\r\n return $result;\r\n\r\n }\r", "label": 0, "label_name": "vulnerable"} -{"code": " public function testTagWithoutNameThrowsException()\n {\n $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml'));\n try {\n $loader->load('badtag2.yml');\n $this->fail('->load() should throw an exception when a tag is missing the name key');\n } catch (\\Exception $e) {\n $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if a tag is missing the name key');\n $this->assertStringStartsWith('A \"tags\" entry is missing a \"name\" key for service ', $e->getMessage(), '->load() throws an InvalidArgumentException if a tag is missing the name key');\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": "static GCObject **correctgraylist (GCObject **p) {\n GCObject *curr;\n while ((curr = *p) != NULL) {\n switch (curr->tt) {\n case LUA_VTABLE: case LUA_VUSERDATA: {\n GCObject **next = getgclist(curr);\n if (getage(curr) == G_TOUCHED1) { /* touched in this cycle? */\n lua_assert(isgray(curr));\n gray2black(curr); /* make it black, for next barrier */\n changeage(curr, G_TOUCHED1, G_TOUCHED2);\n p = next; /* go to next element */\n }\n else { /* not touched in this cycle */\n if (!iswhite(curr)) { /* not white? */\n lua_assert(isold(curr));\n if (getage(curr) == G_TOUCHED2) /* advance from G_TOUCHED2... */\n changeage(curr, G_TOUCHED2, G_OLD); /* ... to G_OLD */\n gray2black(curr); /* make it black */\n }\n /* else, object is white: just remove it from this list */\n *p = *next; /* remove 'curr' from gray list */\n }\n break;\n }\n case LUA_VTHREAD: {\n lua_State *th = gco2th(curr);\n lua_assert(!isblack(th));\n if (iswhite(th)) /* new object? */\n *p = th->gclist; /* remove from gray list */\n else /* old threads remain gray */\n p = &th->gclist; /* go to next element */\n break;\n }\n default: lua_assert(0); /* nothing more could be gray here */\n }\n }\n return p;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "function makeMsg(what, msg) {\n if (msg === undefined)\n msg = what;\n if (tests[t])\n what = tests[t].what;\n else\n what = '';\n return '[' + group + what + ']: ' + msg;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " saveCurrentNode: function () {\n if (this.currentNode) {\n if (this.currentNode != \"root\") {\n this.currentNode.applyData();\n } else {\n // save root node data\n var items = this.rootPanel.queryBy(function(item) {\n if (item == this.compositeIndicesPanel) {\n return false;\n }\n return true;\n });\n\n for (var i = 0; i < items.length; i++) {\n var item = items[i];\n if (typeof item.getValue == \"function\") {\n let value = item.getValue();\n if (typeof item.config.xtype !== 'undefined' && item.config.xtype === 'textfield') {\n value = Ext.util.Format.htmlEncode(value);\n }\n\n this.data[item.name] = value;\n }\n }\n\n if (this.compositeIndicesPanel) {\n this.collectCompositeIndices();\n }\n }\n }\n },", "label": 1, "label_name": "safe"} -{"code": "int test_sqr(BIO *bp, BN_CTX *ctx)\n\t{\n\tBIGNUM a,c,d,e;\n\tint i;\n\n\tBN_init(&a);\n\tBN_init(&c);\n\tBN_init(&d);\n\tBN_init(&e);\n\n\tfor (i=0; i_columnNames);\n $column_index < $nb;\n $column_index++\n ) {\n $html_output .= '';\n $odd_row = !$odd_row;\n //If 'Function' column is present\n $html_output .= $this->_getGeomFuncHtml($column_index);\n //Displays column's name, type, collation and value\n $html_output .= ''\n . htmlspecialchars($this->_columnNames[$column_index]) . '';\n $properties = $this->getColumnProperties($column_index, $column_index);\n $html_output .= '' . $properties['type'] . '';\n $html_output .= '' . $properties['collation'] . '';\n $html_output .= '' . $properties['func'] . '';\n // here, the data-type attribute is needed for a date/time picker\n $html_output .= '' . $properties['value'] . '';\n $html_output .= '';\n //Displays hidden fields\n $html_output .= '';\n $html_output .= '_columnNames[$column_index])\n . '\" />';\n $html_output .= '_columnTypes[$column_index] . '\" />';\n $html_output .= '_columnCollations[$column_index] . '\" />';\n $html_output .= '';\n } // end for", "label": 0, "label_name": "vulnerable"} -{"code": " it \"should raise a ParseError if there is less than 1 arguments\" do\n expect { scope.function_unique([]) }.to( raise_error(Puppet::ParseError))\n end", "label": 0, "label_name": "vulnerable"} -{"code": " it \"returns the group permissions for everyone group too\" do\n category.set_permissions(everyone: :readonly)\n category.save!\n\n json = described_class.new(category, scope: Guardian.new(admin), root: false).as_json\n\n expect(json[:group_permissions]).to eq([\n { permission_type: CategoryGroup.permission_types[:readonly], group_name: 'everyone' },\n ])\n end", "label": 0, "label_name": "vulnerable"} -{"code": " func testThatCompleteImageDownloadFilterDoesNotPickUpUsersWithInvalidAssetId() {\n syncMOC.performGroupedBlockAndWait {\n // GIVEN\n let predicate = ZMUser.completeImageDownloadFilter\n let user = ZMUser(remoteID: UUID.create(), createIfNeeded: true, in: self.syncMOC)\n user?.completeProfileAssetIdentifier = \"not+valid+id\"\n user?.setImage(data: \"foo\".data(using: .utf8), size: .complete)\n\n // THEN\n XCTAssertFalse(predicate.evaluate(with: user))\n }\n }", "label": 1, "label_name": "safe"} -{"code": "function AuthContext(stream, username, service, method, cb) {\n EventEmitter.call(this);\n\n var self = this;\n\n this.username = this.user = username;\n this.service = service;\n this.method = method;\n this._initialResponse = false;\n this._finalResponse = false;\n this._multistep = false;\n this._cbfinal = function(allowed, methodsLeft, isPartial) {\n if (!self._finalResponse) {\n self._finalResponse = true;\n cb(self, allowed, methodsLeft, isPartial);\n }\n };\n this._stream = stream;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " protected function assertSigFig($n, $sigfigs)\n {\n $converter = new HTMLPurifier_UnitConverter();\n $result = $converter->getSigFigs($n);\n $this->assertIdentical($result, $sigfigs);\n }", "label": 1, "label_name": "safe"} -{"code": " function searchName() { return gt('Webpage'); }", "label": 1, "label_name": "safe"} -{"code": " public function save()\n {\n $project = $this->getProject();\n $values = $this->request->getValues();\n $values['project_id'] = $project['id'];\n\n list($valid, $errors) = $this->taskValidator->validateCreation($values);\n\n if (! $valid) {\n $this->flash->failure(t('Unable to create your task.'));\n $this->show($values, $errors);\n } else if (! $this->helper->projectRole->canCreateTaskInColumn($project['id'], $values['column_id'])) {\n $this->flash->failure(t('You cannot create tasks in this column.'));\n $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id'])), true);\n } else {\n $task_id = $this->taskCreationModel->create($values);\n\n if ($task_id > 0) {\n $this->flash->success(t('Task created successfully.'));\n $this->afterSave($project, $values, $task_id);\n } else {\n $this->flash->failure(t('Unable to create this task.'));\n $this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $project['id'])), true);\n }\n }\n }", "label": 1, "label_name": "safe"} -{"code": " jQuery.cleanData = function(elems) {\n var events;\n for (var i = 0, elem; (elem = elems[i]) != null; i++) {\n events = jQuery._data(elem, 'events');\n if (events && events.$destroy) {\n jQuery(elem).triggerHandler('$destroy');\n }\n }\n originalCleanData(elems);\n };", "label": 0, "label_name": "vulnerable"} -{"code": " def any_context?(taxonomy)\n taxonomy.blank?\n end", "label": 1, "label_name": "safe"} -{"code": " public function getName()\n {\n return 'router';\n }", "label": 0, "label_name": "vulnerable"} -{"code": " private static void HandleError(WebSocket websocket, Exception error)\n {\n Console.WriteLine(error.StackTrace + \" \" + error.Message);\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function getMissingAmount()\n {\n if (empty($this->_id)) {\n return (double)$this->amount;\n }\n\n try {\n $select = $this->zdb->select(Contribution::TABLE);\n $select->columns(\n array(\n 'sum' => new Expression('SUM(montant_cotis)')\n )\n )->where([self::PK => $this->_id]);\n\n $results = $this->zdb->execute($select);\n $result = $results->current();\n $dispatched_amount = $result->sum;\n return (double)$this->_amount - (double)$dispatched_amount;\n } catch (Throwable $e) {\n Analog::log(\n 'An error occurred retrieving missing amounts | ' .\n $e->getMessage(),\n Analog::ERROR\n );\n throw $e;\n }\n }", "label": 1, "label_name": "safe"} -{"code": "func (m *MockAccessRequester) GetGrantedScopes() fosite.Arguments {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetGrantedScopes\")\n\tret0, _ := ret[0].(fosite.Arguments)\n\treturn ret0\n}", "label": 1, "label_name": "safe"} -{"code": " public function getSourceKey()\n {\n return $this->sourceKey;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function test_cleanUTF8()\n {\n $this->assertCleanUTF8('Normal string.');\n $this->assertCleanUTF8(\"Test\\tAllowed\\nControl\\rCharacters\");\n $this->assertCleanUTF8(\"null byte: \\0\", 'null byte: ');\n $this->assertCleanUTF8(\"\u3042\uff08\u3044\uff09\u3046\uff08\u3048\uff09\u304a\\0\", \"\u3042\uff08\u3044\uff09\u3046\uff08\u3048\uff09\u304a\"); // test for issue #122\n $this->assertCleanUTF8(\"\\1\\2\\3\\4\\5\\6\\7\", '');\n $this->assertCleanUTF8(\"\\x7F\", ''); // one byte invalid SGML char\n $this->assertCleanUTF8(\"\\xC2\\x80\", ''); // two byte invalid SGML\n $this->assertCleanUTF8(\"\\xF3\\xBF\\xBF\\xBF\"); // valid four byte\n $this->assertCleanUTF8(\"\\xDF\\xFF\", ''); // malformed UTF8\n // invalid codepoints\n $this->assertCleanUTF8(\"\\xED\\xB0\\x80\", '');\n }", "label": 1, "label_name": "safe"} -{"code": " public function __construct($data, $line = null, $col = null)\n {\n $this->data = $data;\n $this->is_whitespace = ctype_space($data);\n $this->line = $line;\n $this->col = $col;\n }", "label": 1, "label_name": "safe"} -{"code": "func (cs chunkState) String() string {\n\tstateString := \"\"\n\tswitch cs {\n\tcase readChunkHeader:\n\t\tstateString = \"readChunkHeader\"\n\tcase readChunkTrailer:\n\t\tstateString = \"readChunkTrailer\"\n\tcase readChunk:\n\t\tstateString = \"readChunk\"\n\tcase verifyChunk:\n\t\tstateString = \"verifyChunk\"\n\tcase eofChunk:\n\t\tstateString = \"eofChunk\"\n\n\t}\n\treturn stateString\n}", "label": 0, "label_name": "vulnerable"} -{"code": "int install_process_keyring_to_cred(struct cred *new)\n{\n\tstruct key *keyring;\n\n\tif (new->process_keyring)\n\t\treturn -EEXIST;\n\n\tkeyring = keyring_alloc(\"_pid\", new->uid, new->gid, new,\n\t\t\t\tKEY_POS_ALL | KEY_USR_VIEW,\n\t\t\t\tKEY_ALLOC_QUOTA_OVERRUN,\n\t\t\t\tNULL, NULL);\n\tif (IS_ERR(keyring))\n\t\treturn PTR_ERR(keyring);\n\n\tnew->process_keyring = keyring;\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function testTrailingHyphenInCommentRemoved()\n {\n $this->config->set('HTML.Trusted', true);\n $this->expectErrorCollection(E_NOTICE, 'Strategy_RemoveForeignElements: Trailing hyphen in comment removed');\n $this->expectContext('CurrentToken', new HTMLPurifier_Token_Comment(' test ', 1));\n $this->invoke('');\n }", "label": 1, "label_name": "safe"} -{"code": " let cb = function () {\n let sent = 0;\n\n if (++returned === total) {\n expect(pool._connections.length).to.be.above(1);\n pool._connections.forEach(function (conn) {\n expect(conn.messages).to.be.above(1);\n sent += conn.messages;\n });\n\n expect(sent).to.be.equal(total);\n\n pool.close();\n return done();\n }\n };", "label": 1, "label_name": "safe"} -{"code": "function db_start()\n{\n global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType;\n\n switch ($DatabaseType) {\n case 'mysqli':\n $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort);\n break;\n }\n\n // Error code for both.\n if ($connection === false) {\n switch ($DatabaseType) {\n case 'mysqli':\n $errormessage = mysqli_error($connection);\n break;\n }\n db_show_error(\"\", \"\" . _couldNotConnectToDatabase . \": $DatabaseServer\", $errormessage);\n }\n return $connection;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "TEST_P(DownstreamProtocolIntegrationTest, ManyRequestHeadersTimeout) {\n // Set timeout for 5 seconds, and ensure that a request with 20k+ headers can be sent.\n testManyRequestHeaders(std::chrono::milliseconds(5000));\n}", "label": 1, "label_name": "safe"} -{"code": "\tparseArguments: function() {\n\t\tvar args = [];\n\t\tif (this.peekToken().text !== \")\") {\n\t\t\tdo {\n\t\t\t\targs.push(this.filterChain());\n\t\t\t} while (this.expect(\",\"));\n\t\t}\n\t\treturn args;\n\t},", "label": 1, "label_name": "safe"} -{"code": " getItemHtml: function (value) {\n var translatedValue = this.translatedOptions[value] || value;\n\n var html = '' +\n '
' +\n '
' +\n '' +\n '
' +\n '
' +\n '' +\n '

' +\n '
';\n\n return html;\n },", "label": 0, "label_name": "vulnerable"} -{"code": " it 'has_interface_with absent ipaddress' do\n pp = <<-EOS\n $a = '128.0.0.1'\n $o = has_interface_with('ipaddress', $a)\n notice(inline_template('has_interface_with is <%= @o.inspect %>'))\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/has_interface_with is false/)\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": "static int __init mb2cache_init(void)\n{\n\tmb2_entry_cache = kmem_cache_create(\"mbcache\",\n\t\t\t\tsizeof(struct mb2_cache_entry), 0,\n\t\t\t\tSLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL);\n\tBUG_ON(!mb2_entry_cache);\n\treturn 0;\n}", "label": 1, "label_name": "safe"} -{"code": " void testSetNullHeaderValue() {\n assertThatThrownBy(() -> newEmptyHeaders().set(\"test\", (String) null))\n .isInstanceOf(NullPointerException.class);\n }", "label": 1, "label_name": "safe"} -{"code": " public function preFilter($html, $config, $context)\n {\n return $html;\n }", "label": 1, "label_name": "safe"} -{"code": " public function test_convertToUTF8_spuriousEncoding()\n {\n if (!HTMLPurifier_Encoder::iconvAvailable()) return;\n $this->config->set('Core.Encoding', 'utf99');\n $this->expectError('Invalid encoding utf99');\n $this->assertIdentical(\n HTMLPurifier_Encoder::convertToUTF8(\"\\xF6\", $this->config, $this->context),\n ''\n );\n }", "label": 1, "label_name": "safe"} -{"code": "def shutdown():\n task = int(request.args.get(\"parameter\").strip())\n showtext = {}\n if task in (0, 1): # valid commandos received\n # close all database connections\n calibre_db.dispose()\n ub.dispose()\n\n if task == 0:\n showtext['text'] = _(u'Server restarted, please reload page')\n else:\n showtext['text'] = _(u'Performing shutdown of server, please close window')\n # stop gevent/tornado server\n web_server.stop(task == 0)\n return json.dumps(showtext)\n\n if task == 2:\n log.warning(\"reconnecting to calibre database\")\n calibre_db.reconnect_db(config, ub.app_DB_path)\n showtext['text'] = _(u'Reconnect successful')\n return json.dumps(showtext)\n\n showtext['text'] = _(u'Unknown command')\n return json.dumps(showtext), 400", "label": 0, "label_name": "vulnerable"} -{"code": " public function render()\n {\n $result = new Dto_FormResult('notsubmitted');\n\n // Check permissions\n $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_perform_login, '');\n\n /*\n * Create a default SpotUser so the form is always able to render\n * the values of the form\n */\n $credentials = ['username' => '',\n 'password' => '', ];\n\n // Instantiate the Spot user system\n $svcUserAuth = new ServiceS_User_Authentication($this->_daoFactory, $this->_settings);\n\n // set the page title\n $this->_pageTitle = 'spot: login';\n\n // bring the form action into the local scope\n $formAction = $this->_loginForm['action'];\n\n // Are we already submitting the form login?\n if (!empty($formAction)) {\n // make sure we can simply assume all fields are there\n $credentials = array_merge($credentials, $this->_loginForm);\n\n $tryLogin = $svcUserAuth->authenticate($credentials['username'], $credentials['password']);\n if (!$tryLogin) {\n /* Create an audit event */\n if ($this->_settings->get('auditlevel') != SpotSecurity::spot_secaudit_none) {\n $spotAudit = new SpotAudit($this->_daoFactory, $this->_settings, $this->_currentSession['user'], $this->_currentSession['session']['ipaddr']);\n $spotAudit->audit(SpotSecurity::spotsec_perform_login, 'incorrect user or pass', false);\n } // if\n\n $result->addError(_('Login Failed'));\n } else {\n $result->setResult('success');\n $this->_currentSession = $tryLogin;\n } // else\n } else {\n // When the user is already logged in, show this as a warning\n if ($this->_currentSession['user']['userid'] != $this->_settings->get('nonauthenticated_userid')) {\n $result->addError(_('You are already logged in'));\n } // if\n } // else\n\n //- display stuff -#\n $this->template('login', ['loginform' => $credentials,\n 'result' => $result,\n 'http_referer' => $this->_loginForm['http_referer'],\n 'data' => $this->_params['data'], ]);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "function db_start()\n{\n global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType;\n\n switch ($DatabaseType) {\n case 'mysqli':\n $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort);\n break;\n }\n\n // Error code for both.\n if ($connection === false) {\n switch ($DatabaseType) {\n case 'mysqli':\n $errormessage = mysqli_error($connection);\n break;\n }\n db_show_error(\"\", \"\" . _couldNotConnectToDatabase . \": $DatabaseServer\", $errormessage);\n }\n return $connection;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "k.scrollHeight-k.offsetHeight&&D()},mxEvent.addListener(k,\"scroll\",B))}}),y)});p.okButton.setAttribute(\"disabled\",\"disabled\");this.ui.spinner.spin(k,mxResources.get(\"loading\"));var t=mxUtils.bind(this,function(z){var L=this.ui.spinner,C=0;this.ui.spinner.stop();var D=function(){L.spin(k,mxResources.get(\"loading\"));C+=1},G=function(){--C;0===C&&L.stop()};null==z&&(k.innerHTML=\"\",z=1);null!=B&&(mxEvent.removeListener(k,\"scroll\",B),B=null);null!=A&&null!=A.parentNode&&A.parentNode.removeChild(A);A=document.createElement(\"a\");", "label": 0, "label_name": "vulnerable"} -{"code": " public void shouldNotAllowToListWithBaseOutsideRoot() throws Exception {\n // given\n expectedException.expect(IllegalArgumentException.class);\n expectedException.expectMessage(containsString(\"may not be located outside base path\"));\n\n // when\n logViewEndpoint.view(\"somefile\", \"../otherdir\", null, null);\n }", "label": 1, "label_name": "safe"} -{"code": "k&&k(x)}}),k)};EditorUi.prototype.removeDatabaseItem=function(c,e,g,k){this.openDatabase(mxUtils.bind(this,function(m){k=k||\"objects\";Array.isArray(k)||(k=[k],c=[c]);m=m.transaction(k,\"readwrite\");m.oncomplete=e;m.onerror=g;for(var q=0;qparams);\n// $parent = isset($this->params['cat']) ? $this->params['cat'] : expSession::get('catid');\n $catid = expSession::get('catid');\n $parent = !empty($catid) ? $catid : (!empty($this->params['cat']) ? $this->params['cat'] : 0);\n $category = new storeCategory($parent);\n $categories = $category->getEcomSubcategories();\n $ancestors = $category->pathToNode();\n assign_to_template(array(\n 'categories' => $categories,\n 'ancestors' => $ancestors,\n 'category' => $category\n ));\n }", "label": 0, "label_name": "vulnerable"} -{"code": " private ModelAndView renameGroup(HttpServletRequest request, HttpServletResponse response) throws Exception {\n \n String oldName = request.getParameter(\"groupName\");\n String newName = request.getParameter(\"newName\");\n \n if (StringUtils.hasText(oldName) && StringUtils.hasText(newName)) {\n m_groupRepository.renameGroup(oldName, newName);\n }\n \n return listGroups(request, response);\n }", "label": 0, "label_name": "vulnerable"} -{"code": " main.resubscribeStates = function () {\n for (const pattern in main.subscribesStates) {\n if (main.subscribesStates.hasOwnProperty(pattern) && main.subscribesStates[pattern]) {\n console.debug('Re-Subscribe: ' + pattern);\n main.socket.emit('subscribe', pattern);\n }\n }\n };", "label": 1, "label_name": "safe"} -{"code": " foreach ($mergedPermissions as $mergedPermission => $value) {\n // Strip the '*' off the beginning of the permission.\n $checkPermission = substr($permission, 1);\n\n // We will make sure that the merged permission does not\n // exactly match our permission, but ends with it.\n if ($checkPermission != $mergedPermission && ends_with($mergedPermission, $checkPermission) && $value === 1) {\n $matched = true;\n break;\n }\n }", "label": 1, "label_name": "safe"} -{"code": " public function __clone()\n {\n if ($this->debug) {\n $this->startTime = microtime(true);\n }\n\n $this->booted = false;\n $this->container = null;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "g?\"&mime=\"+g:\"\")+(null!=m?\"&format=\"+m:\"\")+(null!=q?\"&base64=\"+q:\"\")+(null!=e?\"&filename=\"+encodeURIComponent(e):\"\")+(k?\"&binary=1\":\"\"))};EditorUi.prototype.base64ToBlob=function(c,e){e=e||\"\";c=atob(c);for(var g=c.length,k=Math.ceil(g/1024),m=Array(k),q=0;qID;\n\n\t\t// show on single sell media pages\n\t\tif ( is_singular( 'sell_media_item' ) || sell_media_attachment( $post_id ) || sell_media_is_search() ) {\n\n\t\t\t// bail if it's password protected item\n\t\t\tif ( post_password_required( $post ) || ( isset( $post->post_parent ) && post_password_required( $post->post_parent ) ) ) {\n\t\t\t\treturn $content;\n\t\t\t}\n\n\t\t\t$has_multiple_attachments = sell_media_has_multiple_attachments( $post_id );\n\t\t\t$wrap = ( ! $has_multiple_attachments || 'attachment' === get_post_type( $post_id ) ) ? true : false;\n\t\t\t$new_content = '';\n\n\t\t\t// only wrap content if a single image/media is being viewed\n\t\t\tif ( $wrap ) {\n\t\t\t\t$new_content .= '
';\n\t\t\t}\n\n\t\t\t$new_content .= sell_media_breadcrumbs();\n\t\t\t$new_content .= sell_media_get_media();\n\t\t\t$new_content .= $content;\n\n\t\t\t// only wrap content if a single image/media is being viewed\n\t\t\tif ( $wrap ) {\n\t\t\t\t$new_content .= '
';\n\t\t\t}\n\n\t\t\t$content = $new_content;\n\n\t\t\t// set the post views, used for popular query\n\t\t\tsell_media_set_post_views( $post_id );\n\t\t}\n\n\t\treturn apply_filters( 'sell_media_content', $content );\n\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": " fn drop(&mut self) {\n if self.needs_inst_drop {\n unsafe {\n let inst = self.inst.as_mut();\n\n // The `inst.alloc` field manages the memory of the instance\n // itself. Note, though, that this field is in a `ManuallyDrop`\n // so it won't get dropped automatically in `drop_in_place`.\n // This is the point where we take over that precise drop.\n //\n // By using `take` here we're basically calling `ptr::read`\n // which \"duplicates\" the `alloc` since the `alloc` local\n // variable here is the exact same as `inst.alloc`. All we do\n // with `inst`, though, is call `drop_in_place`, which\n // invalidates every other field in `inst`.\n let alloc: Alloc = ManuallyDrop::take(&mut inst.alloc);\n\n // drop the actual instance\n std::ptr::drop_in_place(inst);\n\n // Now that we're 100% done with the instance, destructors and\n // all, we can release the memory of the instance back to the\n // original allocator from whence it came (be it mmap or uffd\n // based). This will run the \"official\" destructor for `Alloc`\n // which internally does the release. Note that after this\n // operation the `inst` pointer is invalid and can no longer be\n // used.\n drop(alloc);\n }\n }\n }", "label": 1, "label_name": "safe"} -{"code": " public function testDirectiveDefaultInvalid()\n {\n $d = $this->makeDirective('Ns.Dir');\n $d->default = 'asdf';\n $d->type = 'int';\n $d->description = 'Description';\n\n $this->expectValidationException(\"Default in directive 'Ns.Dir' had error: Expected type int, got string\");\n $this->validator->validate($this->interchange);\n }", "label": 1, "label_name": "safe"} -{"code": " public function filter(&$uri, $config, $context)\n {\n // check if filter not applicable\n if (!$config->get('HTML.SafeIframe')) {\n return true;\n }\n // check if the filter should actually trigger\n if (!$context->get('EmbeddedURI', true)) {\n return true;\n }\n $token = $context->get('CurrentToken', true);\n if (!($token && $token->name == 'iframe')) {\n return true;\n }\n // check if we actually have some whitelists enabled\n if ($this->regexp === null) {\n return false;\n }\n // actually check the whitelists\n return preg_match($this->regexp, $uri->toString());\n }", "label": 1, "label_name": "safe"} -{"code": " public function getPath()\n {\n return $this->path;\n }", "label": 1, "label_name": "safe"} -{"code": "int ConnectionImpl::onFrameSend(const nghttp2_frame* frame) {\n // The nghttp2 library does not cleanly give us a way to determine whether we received invalid\n // data from our peer. Sometimes it raises the invalid frame callback, and sometimes it does not.\n // In all cases however it will attempt to send a GOAWAY frame with an error status. If we see\n // an outgoing frame of this type, we will return an error code so that we can abort execution.\n ENVOY_CONN_LOG(trace, \"sent frame type={}\", connection_, static_cast(frame->hd.type));\n switch (frame->hd.type) {\n case NGHTTP2_GOAWAY: {\n ENVOY_CONN_LOG(debug, \"sent goaway code={}\", connection_, frame->goaway.error_code);\n if (frame->goaway.error_code != NGHTTP2_NO_ERROR) {\n return NGHTTP2_ERR_CALLBACK_FAILURE;\n }\n break;\n }\n\n case NGHTTP2_RST_STREAM: {\n ENVOY_CONN_LOG(debug, \"sent reset code={}\", connection_, frame->rst_stream.error_code);\n stats_.tx_reset_.inc();\n break;\n }\n\n case NGHTTP2_HEADERS:\n case NGHTTP2_DATA: {\n StreamImpl* stream = getStream(frame->hd.stream_id);\n if (stream->headers_) {\n // Verify that the final HeaderMap's byte size is under the limit before sending frames.\n // This assert iterates over the HeaderMap.\n ASSERT(stream->headers_->byteSize().has_value() &&\n stream->headers_->byteSize().value() == stream->headers_->byteSizeInternal());\n }\n stream->local_end_stream_sent_ = frame->hd.flags & NGHTTP2_FLAG_END_STREAM;\n break;\n }\n }\n\n return 0;\n}", "label": 1, "label_name": "safe"} -{"code": " public function testShiftJIS()\n {\n if (!HTMLPurifier_Encoder::iconvAvailable()) return;\n $this->config->set('Core.Encoding', 'Shift_JIS');\n // This actually looks like a Yen, but we're going to treat it differently\n $this->assertIdentical(\n HTMLPurifier_Encoder::convertFromUTF8('\\\\~', $this->config, $this->context),\n '\\\\~'\n );\n $this->assertIdentical(\n HTMLPurifier_Encoder::convertToUTF8('\\\\~', $this->config, $this->context),\n '\\\\~'\n );\n }", "label": 1, "label_name": "safe"} -{"code": " public function test_generateFromToken_text()\n {\n $this->assertGenerateFromToken(\n new HTMLPurifier_Token_Text('Foobar.<>'),\n 'Foobar.<>'\n );\n }", "label": 1, "label_name": "safe"} -{"code": " it 'should set wsgi_daemon_process_options' do\n is_expected.to contain_file(\"25-#{title}.conf\").with_content(\n /^ WSGIDaemonProcess example.org processes=2 threads=15$/\n )\n end", "label": 0, "label_name": "vulnerable"} -{"code": " def add_file_signed name, mode, signer\n digest_algorithms = [\n signer.digest_algorithm,\n Digest::SHA512,\n ].compact.uniq\n\n digests = add_file_digest name, mode, digest_algorithms do |io|\n yield io\n end\n\n signature_digest = digests.values.compact.find do |digest|\n digest_name =\n if digest.respond_to? :name then\n digest.name\n else\n /::([^:]+)$/ =~ digest.class.name\n $1\n end\n\n digest_name == signer.digest_name\n end\n\n raise \"no #{signer.digest_name} in #{digests.values.compact}\" unless signature_digest\n\n if signer.key then\n signature = signer.sign signature_digest.digest\n\n add_file_simple \"#{name}.sig\", 0444, signature.length do |io|\n io.write signature\n end\n end\n\n digests\n end", "label": 1, "label_name": "safe"} -{"code": " public function testOverrideSingle()\n {\n $this->assertParse('OverrideSingle.txt', array(\n 'KEY' => 'New',\n ));\n }", "label": 1, "label_name": "safe"} -{"code": " public AbstractXmlConfigRootTagRecognizer(String expectedRootNode) throws Exception {\n this.expectedRootNode = expectedRootNode;\n SAXParserFactory factory = XmlUtil.getSAXParserFactory();\n saxParser = factory.newSAXParser();\n }", "label": 1, "label_name": "safe"} -{"code": " public function update()\n {\n $project = $this->getProject();\n $category = $this->getCategory($project);\n\n $values = $this->request->getValues();\n $values['project_id'] = $project['id'];\n $values['id'] = $category['id'];\n\n list($valid, $errors) = $this->categoryValidator->validateModification($values);\n\n if ($valid) {\n if ($this->categoryModel->update($values)) {\n $this->flash->success(t('This category has been updated successfully.'));\n return $this->response->redirect($this->helper->url->to('CategoryController', 'index', array('project_id' => $project['id'])));\n } else {\n $this->flash->failure(t('Unable to update this category.'));\n }\n }\n\n return $this->edit($values, $errors);\n }", "label": 1, "label_name": "safe"} -{"code": " public function enable()\n {\n $this->checkCSRFParam();\n $project = $this->getProject();\n $swimlane_id = $this->request->getIntegerParam('swimlane_id');\n\n if ($this->swimlaneModel->enable($project['id'], $swimlane_id)) {\n $this->flash->success(t('Swimlane updated successfully.'));\n } else {\n $this->flash->failure(t('Unable to update this swimlane.'));\n }\n\n $this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));\n }", "label": 0, "label_name": "vulnerable"} -{"code": "TEST_F(GroupVerifierTest, TestRequiresAnyWithAllowMissingButUnknownIssuer) {\n TestUtility::loadFromYaml(RequiresAnyConfig, proto_config_);\n proto_config_.mutable_rules(0)\n ->mutable_requires()\n ->mutable_requires_any()\n ->add_requirements()\n ->mutable_allow_missing();\n\n createAsyncMockAuthsAndVerifier(std::vector{\"example_provider\", \"other_provider\"});\n EXPECT_CALL(mock_cb_, onComplete(Status::JwtUnknownIssuer));\n\n auto headers = Http::TestRequestHeaderMapImpl{};\n context_ = Verifier::createContext(headers, parent_span_, &mock_cb_);\n verifier_->verify(context_);\n callbacks_[\"example_provider\"](Status::JwtMissed);\n callbacks_[\"other_provider\"](Status::JwtUnknownIssuer);\n}", "label": 1, "label_name": "safe"} -{"code": " $deps = get_dependency_lookup($file) + $deps;\n }\n $cache[$file] = $deps;\n return $deps;\n}", "label": 1, "label_name": "safe"} -{"code": " public function testSmtpConnect()\n {\n $this->Mail->SMTPDebug = 4; //Show connection-level errors\n $this->assertTrue($this->Mail->smtpConnect(), 'SMTP single connect failed');\n $this->Mail->smtpClose();\n $this->Mail->Host = \"ssl://localhost:12345;tls://localhost:587;10.10.10.10:54321;localhost:12345;10.10.10.10\";\n $this->assertFalse($this->Mail->smtpConnect(), 'SMTP bad multi-connect succeeded');\n $this->Mail->smtpClose();\n $this->Mail->Host = \"localhost:12345;10.10.10.10:54321;\" . $_REQUEST['mail_host'];\n $this->assertTrue($this->Mail->smtpConnect(), 'SMTP multi-connect failed');\n $this->Mail->smtpClose();\n $this->Mail->Host = \" localhost:12345 ; \" . $_REQUEST['mail_host'] . ' ';\n $this->assertTrue($this->Mail->smtpConnect(), 'SMTP hosts with stray spaces failed');\n $this->Mail->smtpClose();\n $this->Mail->Host = $_REQUEST['mail_host'];\n //Need to pick a harmless option so as not cause problems of its own! socket:bind doesn't work with Travis-CI\n $this->assertTrue(\n $this->Mail->smtpConnect(array('ssl' => array('verify_depth' => 10))),\n 'SMTP connect with options failed'\n );\n }", "label": 1, "label_name": "safe"} -{"code": "static u32 read_32(cdk_stream_t s)\n{\n\tbyte buf[4];\n\tsize_t nread = 0;\n\n\tassert(s != NULL);\n\n\tstream_read(s, buf, 4, &nread);\n\tif (nread != 4)\n\t\treturn (u32) -1;\n\treturn buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];\n}", "label": 1, "label_name": "safe"} -{"code": "static void do_sched_cfs_slack_timer(struct cfs_bandwidth *cfs_b)\n{\n\tu64 runtime = 0, slice = sched_cfs_bandwidth_slice();\n\tunsigned long flags;\n\n\t/* confirm we're still not at a refresh boundary */\n\traw_spin_lock_irqsave(&cfs_b->lock, flags);\n\tcfs_b->slack_started = false;\n\tif (cfs_b->distribute_running) {\n\t\traw_spin_unlock_irqrestore(&cfs_b->lock, flags);\n\t\treturn;\n\t}\n\n\tif (runtime_refresh_within(cfs_b, min_bandwidth_expiration)) {\n\t\traw_spin_unlock_irqrestore(&cfs_b->lock, flags);\n\t\treturn;\n\t}\n\n\tif (cfs_b->quota != RUNTIME_INF && cfs_b->runtime > slice)\n\t\truntime = cfs_b->runtime;\n\n\tif (runtime)\n\t\tcfs_b->distribute_running = 1;\n\n\traw_spin_unlock_irqrestore(&cfs_b->lock, flags);\n\n\tif (!runtime)\n\t\treturn;\n\n\truntime = distribute_cfs_runtime(cfs_b, runtime);\n\n\traw_spin_lock_irqsave(&cfs_b->lock, flags);\n\tlsub_positive(&cfs_b->runtime, runtime);\n\tcfs_b->distribute_running = 0;\n\traw_spin_unlock_irqrestore(&cfs_b->lock, flags);\n}", "label": 1, "label_name": "safe"} -{"code": "function GoodAuthDigestTestController($serverPort) {\n $args = array('Authorization' => 'Digest username=\"admin\", ' .\n 'realm=\"Restricted area\", nonce=\"564a12611dae8\", ' .\n 'uri=\"/test_auth_digest.php\", cnonce=\"MjIyMTg1\", nc=00000001, ' .\n 'qop=\"auth\", response=\"e544aaed06917adea3e5c74dd49f0e32\", ' .\n 'opaque=\"cdce8a5c95a1427d74df7acbf41c9ce0\"');\n var_dump(request(php_uname('n'), $serverPort, \"test_auth_digest.php\",\n [], [], $args));\n}", "label": 0, "label_name": "vulnerable"} -{"code": " def test_it_works_with_explicit_external_host(self, app, monkeypatch):\n with app.test_request_context():\n monkeypatch.setattr('flask.request.host_url', 'http://example.com')\n result = _validate_redirect_url('http://works.com',\n _external_host='works.com')\n assert result is True\n monkeypatch.undo()", "label": 0, "label_name": "vulnerable"} -{"code": " protected function postFilterCallback($matches) {\n $url = $this->armorUrl($matches[1]);\n return ''.\n ''.\n ''.\n '';\n\n }", "label": 1, "label_name": "safe"} -{"code": " MoveToRequestBean(final HttpServletRequest req) {\n setPlaceName(RequestUtil.getParameter(req, PLACE_NAME));\n if (getPlaceName() == null) {\n throw new IllegalArgumentException(\"Missing place name\");\n }\n\n final String agentData = RequestUtil.getParameter(req, AGENT_SERIAL);\n if (agentData == null) {\n throw new IllegalArgumentException(\"Missing serialized agent data\");\n }\n setPayload(agentData);\n\n setErrorCount(RequestUtil.getIntParam(req, MOVE_ERROR_COUNT, 0));\n\n final String[] p = req.getParameterValues(ITINERARY_ITEM);\n if (p != null && p.length > 0) {\n this.itineraryItems = new ArrayList();\n for (int i = 0; i < p.length; i++) {\n this.itineraryItems.add(new DirectoryEntry(p[i]));\n }\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public virtual Task RenameAsync(string newName, bool verify = true, CancellationToken cancellationToken = default)\n {\n cancellationToken.ThrowIfCancellationRequested();\n\n if (verify && !this.CanRename()) throw new PermissionDeniedException();\n\n var newPath = PathHelper.GetFullPath(PathHelper.SafelyCombine(Parent.FullName, Parent.FullName, newName));\n directoryInfo.MoveTo(newPath);\n return Task.FromResult(new FileSystemDirectory(newPath, volume));\n }", "label": 1, "label_name": "safe"} -{"code": " it 'rejects with empty array' do\n pp = <<-EOS\n $o = reject([],'aaa')\n notice(inline_template('reject is <%= @o.inspect %>'))\n EOS\n\n apply_manifest(pp, :catch_failures => true) do |r|\n expect(r.stdout).to match(/reject is \\[\\]/)\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": "\"-\",\"lockUnlock\",\"enterGroup\"],null,ea),O.addSeparator(),this.addSubmenu(\"layout\",O)):ka.isSelectionEmpty()&&ka.isEnabled()?(O.addSeparator(),this.addMenuItems(O,[\"editData\"],null,ea),O.addSeparator(),this.addSubmenu(\"layout\",O),this.addSubmenu(\"insert\",O),this.addMenuItems(O,[\"-\",\"exitGroup\"],null,ea)):ka.isEnabled()&&this.addMenuItems(O,[\"-\",\"lockUnlock\"],null,ea)};var H=Menus.prototype.addPopupMenuEditItems;Menus.prototype.addPopupMenuEditItems=function(O,X,ea){H.apply(this,arguments);this.editorUi.editor.graph.isSelectionEmpty()&&\nthis.addMenuItems(O,[\"copyAsImage\"],null,ea)};EditorUi.prototype.toggleFormatPanel=function(O){null!=this.formatWindow?this.formatWindow.window.setVisible(null!=O?O:!this.formatWindow.window.isVisible()):b(this)};DiagramFormatPanel.prototype.isMathOptionVisible=function(){return!0};var G=EditorUi.prototype.destroy;EditorUi.prototype.destroy=function(){null!=this.sidebarWindow&&(this.sidebarWindow.window.setVisible(!1),this.sidebarWindow.window.destroy(),this.sidebarWindow=null);null!=this.formatWindow&&", "label": 0, "label_name": "vulnerable"} -{"code": " } elseif ($token instanceof HTMLPurifier_Token_End) {\n $_extra = '';\n if ($this->_flashCompat) {\n if ($token->name == \"object\" && !empty($this->_flashStack)) {\n // doesn't do anything for now\n }\n }\n return $_extra . 'name . '>';\n\n } elseif ($token instanceof HTMLPurifier_Token_Empty) {", "label": 1, "label_name": "safe"} -{"code": " public function getErrorName($int)\n {\n if (!$this->_loaded) {\n $this->load();\n }\n if (!isset($this->errorNames[$int])) {\n return \"[Error: $int]\";\n }\n return $this->errorNames[$int];\n }", "label": 1, "label_name": "safe"} -{"code": " def log_operations(logger, ops, duration)\n prefix = \" MOPED: #{host}:#{port} \"\n indent = \" \"*prefix.length\n runtime = (\" (%.1fms)\" % duration)\n\n if ops.length == 1\n logger.debug prefix + ops.first.log_inspect + runtime\n else\n first, *middle, last = ops\n\n logger.debug prefix + first.log_inspect\n middle.each { |m| logger.debug indent + m.log_inspect }\n logger.debug indent + last.log_inspect + runtime\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": " def loadNotificationsImpl(userId: UserId, upToWhen: Option[When], request: DebikiRequest[_])\n : mvc.Result = {\n val notfsAndCounts = request.dao.loadNotificationsSkipReviewTasks(userId, upToWhen, request.who)\n OkSafeJson(notfsAndCounts.notfsJson)\n }\n\n\n def markAllNotfsAsSeen(): Action[JsValue] = PostJsonAction(RateLimits.MarkNotfAsSeen,", "label": 1, "label_name": "safe"} -{"code": "\t\t([ key, value ]) => ({ [key]: spawn.bind(null, value) }),\n\t),", "label": 1, "label_name": "safe"} -{"code": " it 'should return correct scheme' do\n should run.with_params('ftp://www.example.com/test','scheme').and_return('ftp') \n end", "label": 0, "label_name": "vulnerable"} -{"code": "\t\t\t\t\t\tunset($return[$key]);\n\t\t\t\t}\n\t\t\t}\n\t\tbreak;\n\t}\n\treturn @array_change_key_case($return,CASE_UPPER);\n}", "label": 1, "label_name": "safe"} -{"code": "function filterLeaks(ok, globals) {\n return filter(globals, function(key) {\n // Firefox and Chrome exposes iframes as index inside the window object\n if (/^d+/.test(key)) return false;\n\n // in firefox\n // if runner runs in an iframe, this iframe's window.getInterface method not init at first\n // it is assigned in some seconds\n if (global.navigator && /^getInterface/.test(key)) return false;\n\n // an iframe could be approached by window[iframeIndex]\n // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak\n if (global.navigator && /^\\d+/.test(key)) return false;\n\n // Opera and IE expose global variables for HTML element IDs (issue #243)\n if (/^mocha-/.test(key)) return false;\n\n var matched = filter(ok, function(ok) {\n if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]);\n return key == ok;\n });\n return matched.length == 0 && (!global.navigator || 'onerror' !== key);\n });\n}", "label": 1, "label_name": "safe"} -{"code": "Status InferenceContext::Multiply(DimensionHandle first,\n DimensionOrConstant second,\n DimensionHandle* out) {\n const int64_t first_value = Value(first);\n const int64_t second_value = Value(second);\n // Special cases.\n if (first_value == 0) {\n *out = first;\n } else if (second_value == 0) {\n *out = MakeDim(second);\n } else if (first_value == 1) {\n *out = MakeDim(second);\n } else if (second_value == 1) {\n *out = first;\n } else if (first_value == kUnknownDim || second_value == kUnknownDim) {\n *out = UnknownDim();\n } else {\n // Invariant: Both values are known and greater than 1.\n const int64_t product = MultiplyWithoutOverflow(first_value, second_value);\n if (product < 0) {\n return errors::InvalidArgument(\n \"Negative dimension size caused by overflow when multiplying \",\n first_value, \" and \", second_value);\n }\n *out = MakeDim(product);\n }\n return Status::OK();\n}", "label": 1, "label_name": "safe"} -{"code": " public function setUp()\n {\n parent::setUp();\n $this->obj = new HTMLPurifier_Strategy_MakeWellFormed();\n }", "label": 1, "label_name": "safe"} -{"code": " private static function _aesEncrypt($data, $secret)\n {\n if (!is_string($data)) {\n throw new \\InvalidArgumentException('Input parameter \"$data\" must be a string.');\n }\n\n if (!function_exists(\"openssl_encrypt\")) {\n throw new \\SimpleSAML_Error_Exception('The openssl PHP module is not loaded.');\n }\n\n $raw = defined('OPENSSL_RAW_DATA') ? OPENSSL_RAW_DATA : true;\n $key = openssl_digest($secret, 'sha256');\n $method = 'AES-256-CBC';\n $ivSize = 16;\n $iv = substr($key, 0, $ivSize);\n\n return $iv.openssl_encrypt($data, $method, $key, $raw, $iv);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "static int pppoe_recvmsg(struct kiocb *iocb, struct socket *sock,\n\t\t struct msghdr *m, size_t total_len, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct sk_buff *skb;\n\tint error = 0;\n\n\tif (sk->sk_state & PPPOX_BOUND) {\n\t\terror = -EIO;\n\t\tgoto end;\n\t}\n\n\tskb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,\n\t\t\t\tflags & MSG_DONTWAIT, &error);\n\tif (error < 0)\n\t\tgoto end;\n\n\tm->msg_namelen = 0;\n\n\tif (skb) {\n\t\ttotal_len = min_t(size_t, total_len, skb->len);\n\t\terror = skb_copy_datagram_iovec(skb, 0, m->msg_iov, total_len);\n\t\tif (error == 0) {\n\t\t\tconsume_skb(skb);\n\t\t\treturn total_len;\n\t\t}\n\t}\n\n\tkfree_skb(skb);\nend:\n\treturn error;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function testBuild()\n {\n $this->config->set('Attr.IDBlacklist', array('foo'));\n $accumulator = HTMLPurifier_IDAccumulator::build($this->config, $this->context);\n $this->assertTrue( isset($accumulator->ids['foo']) );\n }", "label": 1, "label_name": "safe"} -{"code": "fp_readl(char *s, int size, struct tok_state *tok)\n{\n PyObject* bufobj;\n const char *buf;\n Py_ssize_t buflen;\n\n /* Ask for one less byte so we can terminate it */\n assert(size > 0);\n size--;\n\n if (tok->decoding_buffer) {\n bufobj = tok->decoding_buffer;\n Py_INCREF(bufobj);\n }\n else\n {\n bufobj = PyObject_CallObject(tok->decoding_readline, NULL);\n if (bufobj == NULL)\n goto error;\n }\n if (PyUnicode_CheckExact(bufobj))\n {\n buf = PyUnicode_AsUTF8AndSize(bufobj, &buflen);\n if (buf == NULL) {\n goto error;\n }\n }\n else\n {\n buf = PyByteArray_AsString(bufobj);\n if (buf == NULL) {\n goto error;\n }\n buflen = PyByteArray_GET_SIZE(bufobj);\n }\n\n Py_XDECREF(tok->decoding_buffer);\n if (buflen > size) {\n /* Too many chars, the rest goes into tok->decoding_buffer */\n tok->decoding_buffer = PyByteArray_FromStringAndSize(buf+size,\n buflen-size);\n if (tok->decoding_buffer == NULL)\n goto error;\n buflen = size;\n }\n else\n tok->decoding_buffer = NULL;\n\n memcpy(s, buf, buflen);\n s[buflen] = '\\0';\n if (buflen == 0) /* EOF */\n s = NULL;\n Py_DECREF(bufobj);\n return s;\n\nerror:\n Py_XDECREF(bufobj);\n return error_ret(tok);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "function(){g.checked&&(null==e||e.checked)?q.removeAttribute(\"disabled\"):q.setAttribute(\"disabled\",\"disabled\")}));mxUtils.br(c);return{getLink:function(){return g.checked?\"blank\"===q.value?\"_blank\":m:null},getEditInput:function(){return g},getEditSelect:function(){return q}}};EditorUi.prototype.addLinkSection=function(c,e){function g(){var x=document.createElement(\"div\");x.style.width=\"100%\";x.style.height=\"100%\";x.style.boxSizing=\"border-box\";null!=q&&q!=mxConstants.NONE?(x.style.border=\"1px solid black\",", "label": 0, "label_name": "vulnerable"} -{"code": "void cJSON_ReplaceItemInObject( cJSON *object, const char *string, cJSON *newitem )\n{\n\tint i = 0;\n\tcJSON *c = object->child;\n\twhile ( c && cJSON_strcasecmp( c->string, string ) ) {\n\t\t++i;\n\t\tc = c->next;\n\t}\n\tif ( c ) {\n\t\tnewitem->string = cJSON_strdup( string );\n\t\tcJSON_ReplaceItemInArray( object, i, newitem );\n\t}\n}", "label": 0, "label_name": "vulnerable"} -{"code": " def handle(self, command, kwargs=None):\n \"\"\"\n Dispatch and handle processing of the given command.\n\n :param command: Name of command to run.\n :type command: unicode\n :param kwargs: Arguments to pass to the command handler. If empty, `request.POST` is used.\n :type kwargs: dict\n :return: response.\n :rtype: HttpResponse\n \"\"\"\n\n kwargs = kwargs or dict(six.iteritems(self.request.POST))\n try:\n handler = self.get_command_handler(command)\n if not handler or not callable(handler):\n raise Problem(_(\"Error! Invalid command `%s`.\") % escape(command))\n kwargs.pop(\"csrfmiddlewaretoken\", None) # The CSRF token should never be passed as a kwarg\n kwargs.pop(\"command\", None) # Nor the command\n kwargs.update(request=self.request, basket=self.basket)\n kwargs = self.preprocess_kwargs(command, kwargs)\n\n response = handler(**kwargs) or {}\n\n except (Problem, ValidationError) as exc:\n if not self.ajax:\n raise\n msg = exc.message if hasattr(exc, \"message\") else exc\n response = {\n \"error\": force_text(msg, errors=\"ignore\"),\n \"code\": force_text(getattr(exc, \"code\", None) or \"\", errors=\"ignore\"),\n }\n\n response = self.postprocess_response(command, kwargs, response)\n\n if self.ajax:\n return JsonResponse(response)\n\n return_url = response.get(\"return\") or kwargs.get(\"return\")\n if return_url and return_url.startswith(\"/\"):\n return HttpResponseRedirect(return_url)\n return redirect(\"shuup:basket\")", "label": 1, "label_name": "safe"} -{"code": "static u16 read_16(cdk_stream_t s)\n{\n\tbyte buf[2];\n\tsize_t nread;\n\n\tassert(s != NULL);\n\n\tstream_read(s, buf, 2, &nread);\n\tif (nread != 2)\n\t\treturn (u16) - 1;\n\treturn buf[0] << 8 | buf[1];\n}", "label": 0, "label_name": "vulnerable"} -{"code": " foreach(var cert in metaDataCertificates)\n {\n // Just like we stop publishing Encryption cert immediately when a Future one is added,\n // in the case of a \"Both\" cert we should switch the current use to Signing so that Idp's stop sending\n // us certs encrypted with the old key\n if (cert.Use == CertificateUse.Both && cert.Status == CertificateStatus.Current && futureBothCertExists)\n {\n cert.Use = CertificateUse.Signing;\n }\n\n if (cert.MetadataPublishOverride == MetadataPublishOverrideType.PublishEncryption)\n {\n cert.Use = CertificateUse.Encryption;\n }\n if (cert.MetadataPublishOverride == MetadataPublishOverrideType.PublishSigning)\n {\n cert.Use = CertificateUse.Signing;\n }\n if (cert.MetadataPublishOverride == MetadataPublishOverrideType.PublishUnspecified)\n {\n cert.Use = CertificateUse.Both;\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": "receive_carbon(void **state)\n{\n prof_input(\"/carbons on\");\n\n prof_connect();\n assert_true(stbbr_received(\n \"\"\n ));\n\n stbbr_send(\n \"\"\n \"10\"\n \"On my mobile\"\n \"\"\n );\n assert_true(prof_output_exact(\"Buddy1 (mobile) is online, \\\"On my mobile\\\"\"));\n prof_input(\"/msg Buddy1\");\n assert_true(prof_output_exact(\"unencrypted\"));\n\n stbbr_send(\n \"\"\n \"\"\n \"\"\n \"\"\n \"test carbon from recipient\"\n \"\"\n \"\"\n \"\"\n \"\"\n );\n\n assert_true(prof_output_regex(\"Buddy1/mobile: .+test carbon from recipient\"));\n}", "label": 1, "label_name": "safe"} -{"code": "function Id(a,b){var c=a.split(\"_\");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function Jd(a,b,c){var d={mm:b?\"\u043c\u0438\u043d\u0443\u0442\u0430_\u043c\u0438\u043d\u0443\u0442\u044b_\u043c\u0438\u043d\u0443\u0442\":\"\u043c\u0438\u043d\u0443\u0442\u0443_\u043c\u0438\u043d\u0443\u0442\u044b_\u043c\u0438\u043d\u0443\u0442\",hh:\"\u0447\u0430\u0441_\u0447\u0430\u0441\u0430_\u0447\u0430\u0441\u043e\u0432\",dd:\"\u0434\u0435\u043d\u044c_\u0434\u043d\u044f_\u0434\u043d\u0435\u0439\",MM:\"\u043c\u0435\u0441\u044f\u0446_\u043c\u0435\u0441\u044f\u0446\u0430_\u043c\u0435\u0441\u044f\u0446\u0435\u0432\",yy:\"\u0433\u043e\u0434_\u0433\u043e\u0434\u0430_\u043b\u0435\u0442\"};return\"m\"===c?b?\"\u043c\u0438\u043d\u0443\u0442\u0430\":\"\u043c\u0438\u043d\u0443\u0442\u0443\":a+\" \"+Id(d[c],+a)}function Kd(a){return a>1&&5>a}function Ld(a,b,c,d){var e=a+\" \";switch(c){case\"s\":return b||d?\"p\u00e1r sek\u00fand\":\"p\u00e1r sekundami\";case\"m\":return b?\"min\u00fata\":d?\"min\u00fatu\":\"min\u00fatou\";case\"mm\":return b||d?e+(Kd(a)?\"min\u00faty\":\"min\u00fat\"):e+\"min\u00fatami\";break;case\"h\":return b?\"hodina\":d?\"hodinu\":\"hodinou\";case\"hh\":return b||d?e+(Kd(a)?\"hodiny\":\"hod\u00edn\"):e+\"hodinami\";break;case\"d\":return b||d?\"de\u0148\":\"d\u0148om\";case\"dd\":return b||d?e+(Kd(a)?\"dni\":\"dn\u00ed\"):e+\"d\u0148ami\";break;case\"M\":return b||d?\"mesiac\":\"mesiacom\";case\"MM\":return b||d?e+(Kd(a)?\"mesiace\":\"mesiacov\"):e+\"mesiacmi\";break;case\"y\":return b||d?\"rok\":\"rokom\";case\"yy\":return b||d?e+(Kd(a)?\"roky\":\"rokov\"):e+\"rokmi\"}}", "label": 0, "label_name": "vulnerable"} -{"code": " def wrapper_filename\n filename = prefix ? \"#{prefix}_#{wrapper_name}\" : wrapper_name\n \"/usr/local/rvm/bin/#{filename}\"\n end", "label": 0, "label_name": "vulnerable"} -{"code": " it 'delete_args is an array' do\n expect(instance.delete_args.class).to eq(Array)\n end", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic function save_comment( $comment_id = 0, $approval = '' ) {\r\n\t\tif ( !$comment_id || 'spam' === $approval || empty( $_POST['comment_location'] ) || !is_array( $_POST['comment_location'] ) ) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t$location = array(\r\n\t\t\t'lat' => (float) $_POST['comment_location']['lat'],\r\n\t\t\t'lng' => (float) $_POST['comment_location']['lng']\r\n\t\t);\r\n\r\n\t\tGeoMashupDB::set_object_location( 'comment', $comment_id, $location );\r\n\t}\r", "label": 1, "label_name": "safe"} -{"code": " public function setTags(array $tags)\n {\n $this->tags = $tags;\n\n return $this;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {\n TF_LITE_ENSURE_EQ(context, NumInputs(node), 2);\n TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);\n\n const TfLiteTensor* dims;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kDimsTensor, &dims));\n const TfLiteTensor* value;\n TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, kValueTensor, &value));\n\n // Make sure the 1st input tensor is 1-D.\n TF_LITE_ENSURE_EQ(context, NumDimensions(dims), 1);\n\n // Make sure the 1st input tensor is int32 or int64.\n const auto dtype = dims->type;\n TF_LITE_ENSURE(context, dtype == kTfLiteInt32 || dtype == kTfLiteInt64);\n\n // Make sure the 2nd input tensor is a scalar.\n TF_LITE_ENSURE_EQ(context, NumDimensions(value), 0);\n\n TfLiteTensor* output;\n TF_LITE_ENSURE_OK(context,\n GetOutputSafe(context, node, kOutputTensor, &output));\n output->type = value->type;\n\n if (IsConstantTensor(dims)) {\n TF_LITE_ENSURE_OK(context, ResizeOutput(context, dims, output));\n } else {\n SetTensorToDynamic(output);\n }\n return kTfLiteOk;\n}", "label": 1, "label_name": "safe"} -{"code": " unforwardIn(bindAddr, bindPort, cb) {\n if (!this._sock || !this._sock.writable)\n throw new Error('Not connected');\n\n // Send a request to stop forwarding us new connections for a particular\n // address and port\n\n const wantReply = (typeof cb === 'function');\n\n if (wantReply) {\n this._callbacks.push((had_err) => {\n if (had_err) {\n cb(had_err !== true\n ? had_err\n : new Error(`Unable to unbind from ${bindAddr}:${bindPort}`));\n return;\n }\n\n delete this._forwarding[`${bindAddr}:${bindPort}`];\n\n cb();\n });\n }\n\n this._protocol.cancelTcpipForward(bindAddr, bindPort, wantReply);\n\n return this;\n }", "label": 1, "label_name": "safe"} -{"code": " it 'shouldnt stop the service' do\n pp = <<-EOS\n class { 'ntp':\n service_enable => false,\n service_ensure => stopped,\n service_manage => false,\n service_name => '#{servicename}'\n }\n EOS\n apply_manifest(pp, :catch_failures => true)\n end\n\n describe service(servicename) do\n it { should be_running }\n it { should be_enabled }\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": "this.getInitValue()},reset:function(b){this.setValue(this.getInitValue(),b)},setInitValue:function(){this._.initValue=this.getValue()},resetInitValue:function(){this._.initValue=this._[\"default\"]},getInitValue:function(){return this._.initValue}},o=CKEDITOR.tools.extend({},CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors,{onChange:function(b,a){this._.domOnChangeRegistered||(b.on(\"load\",function(){this.getInputElement().on(\"change\",function(){b.parts.dialog.isVisible()&&this.fire(\"change\",{value:this.getValue()})},", "label": 1, "label_name": "safe"} -{"code": " public function getStartingChars()\n {\n return $this->startingChars;\n }", "label": 1, "label_name": "safe"} -{"code": " public function __construct()\n {\n $this->defaultPlist = new HTMLPurifier_PropertyList();\n }", "label": 1, "label_name": "safe"} -{"code": "void grubfs_free (GrubFS *gf) {\n\tif (gf) {\n\t\tif (gf->file && gf->file->device) {\n\t\t\tfree (gf->file->device->disk);\n\t\t}\n\t\t//free (gf->file->device);\n\t\tfree (gf->file);\n\t\tfree (gf);\n\t}\n}", "label": 1, "label_name": "safe"} -{"code": " public function __construct($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)\n {\n $this->id = strtolower($id);\n $this->invalidBehavior = $invalidBehavior;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "set_cs_start(char *line)\n{\n char *p, *q, *r;\n\n if ((p = strstr(line, \"string currentfile\"))) {\n /* enforce presence of `readstring' -- 5/29/99 */\n if (!strstr(line, \"readstring\"))\n return;\n /* locate the name of the charstring start command */\n *p = '\\0';\t\t\t\t\t /* damage line[] */\n q = strrchr(line, '/');\n if (q) {\n r = cs_start;\n ++q;\n while (!isspace(*q) && *q != '{')\n\t*r++ = *q++;\n *r = '\\0';\n }\n *p = 's';\t\t\t\t\t /* repair line[] */\n }\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function __construct()\n {\n $this->phase = self::INIT_PHASE;\n $this->mode = self::BEFOR_HEAD;\n $this->dom = new DOMDocument;\n\n $this->dom->encoding = 'UTF-8';\n $this->dom->preserveWhiteSpace = true;\n $this->dom->substituteEntities = true;\n $this->dom->strictErrorChecking = false;\n }", "label": 1, "label_name": "safe"} -{"code": " protected function getFooService()\n {\n $a = new \\App\\Bar();\n\n $b = new \\App\\Baz($a);\n $b->bar = $a;\n\n $this->services['App\\Foo'] = $instance = new \\App\\Foo($b);\n\n $a->foo = $instance;\n\n return $instance;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " trigger_error(\n '%Attr.IDPrefixLocal cannot be used unless ' .\n '%Attr.IDPrefix is set',\n E_USER_WARNING\n );\n }\n\n if (!$this->selector) {\n $id_accumulator =& $context->get('IDAccumulator');\n if (isset($id_accumulator->ids[$id])) {\n return false;\n }\n }\n\n // we purposely avoid using regex, hopefully this is faster\n\n if ($config->get('Attr.ID.HTML5') === true) {\n if (preg_match('/[\\t\\n\\x0b\\x0c ]/', $id)) {\n return false;\n }\n } else {\n if (ctype_alpha($id)) {\n // OK\n } else {\n if (!ctype_alpha(@$id[0])) {\n return false;\n }\n // primitive style of regexps, I suppose\n $trim = trim(\n $id,\n 'A..Za..z0..9:-._'\n );\n if ($trim !== '') {\n return false;\n }\n }\n }\n\n $regexp = $config->get('Attr.IDBlacklistRegexp');\n if ($regexp && preg_match($regexp, $id)) {\n return false;\n }\n\n if (!$this->selector) {\n $id_accumulator->add($id);\n }\n\n // if no change was made to the ID, return the result\n // else, return the new id if stripping whitespace made it\n // valid, or return false.\n return $id;\n }", "label": 1, "label_name": "safe"} -{"code": "\t\t\t\t\tupdate : function(e, ui) {\n\t\t\t\t\t\tsave();\n\t\t\t\t\t}", "label": 0, "label_name": "vulnerable"} -{"code": "TfLiteStatus EluEval(TfLiteContext* context, TfLiteNode* node) {\n const TfLiteTensor* input = GetInput(context, node, 0);\n TfLiteTensor* output = GetOutput(context, node, 0);\n switch (input->type) {\n case kTfLiteFloat32: {\n optimized_ops::Elu(GetTensorShape(input), GetTensorData(input),\n GetTensorShape(output), GetTensorData(output));\n return kTfLiteOk;\n } break;\n case kTfLiteInt8: {\n OpData* data = reinterpret_cast(node->user_data);\n EvalUsingLookupTable(data, input, output);\n return kTfLiteOk;\n } break;\n default:\n TF_LITE_KERNEL_LOG(\n context, \"Only float32 and int8 is supported currently, got %s.\",\n TfLiteTypeGetName(input->type));\n return kTfLiteError;\n }\n}", "label": 0, "label_name": "vulnerable"} -{"code": " constructor(channel) {\n super({ highWaterMark: MAX_WINDOW });\n\n this._channel = channel;\n }", "label": 1, "label_name": "safe"} -{"code": " def destroy\n @property_hash[:ensure] = :absent\n end", "label": 0, "label_name": "vulnerable"} -{"code": "void AvahiService::resolved(int, int, const QString &name, const QString &, const QString &, const QString &h, int, const QString &, ushort p, const QList &, uint)\n{\n Q_UNUSED(name)\n port=p;\n host=h;\n stop();\n emit serviceResolved(name);\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function testUpdateCustomer()\n {\n $request = $this->gateway->updateCustomer(array('customerReference' => 'cus_1MZSEtqSghKx99'));\n\n $this->assertInstanceOf('Omnipay\\Stripe\\Message\\UpdateCustomerRequest', $request);\n $this->assertSame('cus_1MZSEtqSghKx99', $request->getCustomerReference());\n }", "label": 0, "label_name": "vulnerable"} -{"code": "static void process_constructors (RBinFile *bf, RList *ret, int bits) {\n\tRList *secs = sections (bf);\n\tRListIter *iter;\n\tRBinSection *sec;\n\tint i, type;\n\tr_list_foreach (secs, iter, sec) {\n\t\ttype = -1;\n\t\tif (!strcmp (sec->name, \".fini_array\")) {\n\t\t\ttype = R_BIN_ENTRY_TYPE_FINI;\n\t\t} else if (!strcmp (sec->name, \".init_array\")) {\n\t\t\ttype = R_BIN_ENTRY_TYPE_INIT;\n\t\t} else if (!strcmp (sec->name, \".preinit_array\")) {\n\t\t\ttype = R_BIN_ENTRY_TYPE_PREINIT;\n\t\t}\n\t\tif (type != -1) {\n\t\t\tut8 *buf = calloc (sec->size, 1);\n\t\t\tif (!buf) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t(void)r_buf_read_at (bf->buf, sec->paddr, buf, sec->size);\n\t\t\tif (bits == 32) {\n\t\t\t\tfor (i = 0; (i + 3) < sec->size; i += 4) {\n\t\t\t\t\tut32 addr32 = r_read_le32 (buf + i);\n\t\t\t\t\tif (addr32) {\n\t\t\t\t\t\tRBinAddr *ba = newEntry (sec->paddr + i, (ut64)addr32, type, bits);\n\t\t\t\t\t\tr_list_append (ret, ba);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (i = 0; (i + 7) < sec->size; i += 8) {\n\t\t\t\t\tut64 addr64 = r_read_le64 (buf + i);\n\t\t\t\t\tif (addr64) {\n\t\t\t\t\t\tRBinAddr *ba = newEntry (sec->paddr + i, addr64, type, bits);\n\t\t\t\t\t\tr_list_append (ret, ba);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfree (buf);\n\t\t}\n\t}\n\tr_list_free (secs);\n}", "label": 1, "label_name": "safe"} -{"code": " public function testDestroy()\n {\n $collection = $this->createMongoCollectionMock();\n\n $this->mongo->expects($this->once())\n ->method('selectCollection')\n ->with($this->options['database'], $this->options['collection'])\n ->will($this->returnValue($collection));\n\n $methodName = phpversion('mongodb') ? 'deleteOne' : 'remove';\n\n $collection->expects($this->once())\n ->method($methodName)\n ->with(array($this->options['id_field'] => 'foo'));\n\n $this->assertTrue($this->storage->destroy('foo'));\n }", "label": 1, "label_name": "safe"} -{"code": "\tpublic static function loadFromStream($stream) {\n\t\t$buf = fread($stream, 14); //2+4+2+2+4\n\t\tif ($buf === false) {\n\t\t\treturn false;\n\t\t}\n\n\t\t//\u30b7\u30b0\u30cd\u30c1\u30e3\u30c1\u30a7\u30c3\u30af\n\t\tif ($buf[0] != 'B' || $buf[1] != 'M') {\n\t\t\treturn false;\n\t\t}\n\n\t\t$bitmap_file_header = unpack(\n\t\t\t//BITMAPFILEHEADER\u69cb\u9020\u4f53\n\t\t\t\"vtype/\".\n\t\t\t\"Vsize/\".\n\t\t\t\"vreserved1/\".\n\t\t\t\"vreserved2/\".\n\t\t\t\"Voffbits\", $buf\n\t\t);\n\n\t\treturn self::loadFromStreamAndFileHeader($stream, $bitmap_file_header);\n\t}", "label": 1, "label_name": "safe"} -{"code": "void ptrace_triggered(struct perf_event *bp, int nmi,\n\t\t struct perf_sample_data *data, struct pt_regs *regs)\n{\n\tstruct perf_event_attr attr;\n\n\t/*\n\t * Disable the breakpoint request here since ptrace has defined a\n\t * one-shot behaviour for breakpoint exceptions in PPC64.\n\t * The SIGTRAP signal is generated automatically for us in do_dabr().\n\t * We don't have to do anything about that here\n\t */\n\tattr = bp->attr;\n\tattr.disabled = true;\n\tmodify_user_hw_breakpoint(bp, &attr);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "\tnext: function(elem){return jQuery.nth(elem,2,\"nextSibling\");},", "label": 0, "label_name": "vulnerable"} -{"code": "static struct ucma_multicast* ucma_alloc_multicast(struct ucma_context *ctx)\n{\n\tstruct ucma_multicast *mc;\n\n\tmc = kzalloc(sizeof(*mc), GFP_KERNEL);\n\tif (!mc)\n\t\treturn NULL;\n\n\tmutex_lock(&mut);\n\tmc->id = idr_alloc(&multicast_idr, NULL, 0, 0, GFP_KERNEL);\n\tmutex_unlock(&mut);\n\tif (mc->id < 0)\n\t\tgoto error;\n\n\tmc->ctx = ctx;\n\tlist_add_tail(&mc->list, &ctx->mc_list);\n\treturn mc;\n\nerror:\n\tkfree(mc);\n\treturn NULL;\n}", "label": 1, "label_name": "safe"} -{"code": "\"/\"+c.getSearch()+\"#_CONFIG_\"+Graph.compress(JSON.stringify(P)),F=new EmbedDialog(c,K);c.showDialog(F.container,450,240,!0);F.init()}catch(H){c.handleError(H)}else c.handleError({message:mxResources.get(\"invalidInput\")})}]);z=new TextareaDialog(c,mxResources.get(\"configuration\")+\":\",null!=L?JSON.stringify(JSON.parse(L),null,2):\"\",function(D){if(null!=D)try{if(null!=t.parentNode&&(mxSettings.setShowStartScreen(t.checked),mxSettings.save()),D==L)c.hideDialog();else{if(0 {\n event.reply = (...args: any[]) => {\n event.sender.sendToFrame(event.frameId, ...args);\n };\n};", "label": 0, "label_name": "vulnerable"} -{"code": "cJSON *cJSON_CreateFloat( double num )\n{\n\tcJSON *item = cJSON_New_Item();\n\tif ( item ) {\n\t\titem->type = cJSON_Number;\n\t\titem->valuefloat = num;\n\t\titem->valueint = num;\n\t}\n\treturn item;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " private def createSessionId(site: SiteBrief, userId: PatId): SidOk = {\n val now = globals.now()\n val useridDateRandom =\n userId +\".\"+\n now.millis +\".\"+\n (nextRandomString() take 10)\n\n // If the site id wasn't included in the hash, then an admin from site A could\n // login as admin at site B, if they have the same user id and username.\n val saltedHash = hashSha1Base64UrlSafe(\n s\"$secretSalt.${site.id}.$useridDateRandom\") take HashLength\n\n val value = s\"$saltedHash.$useridDateRandom\"\n SidOk(value, ageInMillis = 0, Some(userId))\n }\n\n\n // ----- Secure cookies\n\n def SecureCookie(name: St, value: St, maxAgeSeconds: Opt[i32] = None,", "label": 1, "label_name": "safe"} -{"code": "func (mr *MockAccessRequesterMockRecorder) SetSession(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetSession\", reflect.TypeOf((*MockAccessRequester)(nil).SetSession), arg0)\n}", "label": 1, "label_name": "safe"} -{"code": "static inline bool isMountable(const RemoteFsDevice::Details &d)\n{\n return RemoteFsDevice::constSshfsProtocol==d.url.scheme() ||\n RemoteFsDevice::constSambaProtocol==d.url.scheme() || RemoteFsDevice::constSambaAvahiProtocol==d.url.scheme();\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function getQuerySelect()\n {\n return '';\n }", "label": 0, "label_name": "vulnerable"} -{"code": "x86_reg X86_insn_reg_intel(unsigned int id, enum cs_ac_type *access)\n{\n\tunsigned int first = 0;\n\tunsigned int last = ARR_SIZE(insn_regs_intel) - 1;\n\tunsigned int mid = ARR_SIZE(insn_regs_intel) / 2;\n\n\tif (!intel_regs_sorted) {\n\t\tmemcpy(insn_regs_intel_sorted, insn_regs_intel,\n\t\t\t\tsizeof(insn_regs_intel_sorted));\n\t\tqsort(insn_regs_intel_sorted,\n\t\t\t\tARR_SIZE(insn_regs_intel_sorted),\n\t\t\t\tsizeof(struct insn_reg), regs_cmp);\n\t\tintel_regs_sorted = true;\n\t}\n\n\twhile (first <= last) {\n\t\tif (insn_regs_intel_sorted[mid].insn < id) {\n\t\t\tfirst = mid + 1;\n\t\t} else if (insn_regs_intel_sorted[mid].insn == id) {\n\t\t\tif (access) {\n\t\t\t\t*access = insn_regs_intel_sorted[mid].access;\n\t\t\t}\n\t\t\treturn insn_regs_intel_sorted[mid].reg;\n\t\t} else {\n\t\t\tif (mid == 0)\n\t\t\t\tbreak;\n\t\t\tlast = mid - 1;\n\t\t}\n\t\tmid = (first + last) / 2;\n\t}\n\n\t// not found\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "function PHPMailerAutoload($classname)\n{\n //Can't use __DIR__ as it's only in PHP 5.3+\n $filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';\n if (is_readable($filename)) {\n require $filename;\n }\n}", "label": 1, "label_name": "safe"} -{"code": "function step8() {\n include_once(GLPI_ROOT . \"/inc/dbmysql.class.php\");\n include_once(GLPI_CONFIG_DIR . \"/config_db.php\");\n $DB = new DB();\n\n if (isset($_POST['send_stats'])) {\n //user has accepted to send telemetry infos; activate cronjob\n $DB->update(\n 'glpi_crontasks',\n ['state' => 1],\n ['name' => 'telemetry']\n );\n }\n\n $url_base = str_replace(\"/install/install.php\", \"\", $_SERVER['HTTP_REFERER']);\n $DB->update(\n 'glpi_configs',\n ['value' => $DB->escape($url_base)], [\n 'context' => 'core',\n 'name' => 'url_base'\n ]\n );\n\n $url_base_api = \"$url_base/apirest.php/\";\n $DB->update(\n 'glpi_configs',\n ['value' => $DB->escape($url_base_api)], [\n 'context' => 'core',\n 'name' => 'url_base_api'\n ]\n );\n\n Session::destroy(); // Remove session data (debug mode for instance) set by web installation\n\n echo \"

\".__('The installation is finished').\"

\";\n\n echo \"

\".__('Default logins / passwords are:').\"

\";\n echo \"

  • \".__('glpi/glpi for the administrator account').\"
  • \";\n echo \"
  • \".__('tech/tech for the technician account').\"
  • \";\n echo \"
  • \".__('normal/normal for the normal account').\"
  • \";\n echo \"
  • \".__('post-only/postonly for the postonly account').\"

\";\n echo \"

\".__('You can delete or modify these accounts as well as the initial data.').\"

\";\n echo \"

\".__('Use GLPI');\n echo \"

\";\n}", "label": 1, "label_name": "safe"} -{"code": "n)for(v=0;vquery('SELECT * FROM nv_orders WHERE website = '.protect($website->id), 'object');\r\n $out = $DB->result();\r\n\r\n if($type='json')\r\n $out = json_encode($out);\r\n\r\n return $out;\r\n }\r", "label": 0, "label_name": "vulnerable"} -{"code": "krb5_gss_context_time(minor_status, context_handle, time_rec)\n OM_uint32 *minor_status;\n gss_ctx_id_t context_handle;\n OM_uint32 *time_rec;\n{\n krb5_error_code code;\n krb5_gss_ctx_id_rec *ctx;\n krb5_timestamp now;\n krb5_deltat lifetime;\n\n ctx = (krb5_gss_ctx_id_rec *) context_handle;\n\n if (! ctx->established) {\n *minor_status = KG_CTX_INCOMPLETE;\n return(GSS_S_NO_CONTEXT);\n }\n\n if ((code = krb5_timeofday(ctx->k5_context, &now))) {\n *minor_status = code;\n save_error_info(*minor_status, ctx->k5_context);\n return(GSS_S_FAILURE);\n }\n\n if ((lifetime = ctx->krb_times.endtime - now) <= 0) {\n *time_rec = 0;\n *minor_status = 0;\n return(GSS_S_CONTEXT_EXPIRED);\n } else {\n *time_rec = lifetime;\n *minor_status = 0;\n return(GSS_S_COMPLETE);\n }\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function toolbar() {\n// global $user;\n\n $menu = array();\n\t\t$dirs = array(\n\t\t\tBASE.'framework/modules/administration/menus',\n\t\t\tBASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus'\n\t\t);\n\n\t\tforeach ($dirs as $dir) {\n\t\t if (is_readable($dir)) {\n\t\t\t $dh = opendir($dir);\n\t\t\t while (($file = readdir($dh)) !== false) {\n\t\t\t\t if (substr($file,-4,4) == '.php' && is_readable($dir.'/'.$file) && is_file($dir.'/'.$file)) {\n\t\t\t\t\t $menu[substr($file,0,-4)] = include($dir.'/'.$file);\n if (empty($menu[substr($file,0,-4)])) unset($menu[substr($file,0,-4)]);\n\t\t\t\t }\n\t\t\t }\n\t\t }\n\t\t}\n\n // sort the top level menus alphabetically by filename\n\t\tksort($menu);\t\t\n\t\t$sorted = array();\n\t\tforeach($menu as $m) $sorted[] = $m;\n \n // slingbar position\n if (isset($_COOKIE['slingbar-top'])){\n $top = $_COOKIE['slingbar-top'];\n } else {\n $top = SLINGBAR_TOP;\n }\n \n\t\tassign_to_template(array(\n 'menu'=>(bs3()) ? $sorted : json_encode($sorted),\n \"top\"=>$top\n ));\n }", "label": 0, "label_name": "vulnerable"} -{"code": " it \"doesn't log in the user when not approved\" do\n SiteSetting.must_approve_users = true\n\n post \"/session/email-login/#{email_token.token}.json\"\n\n expect(response.status).to eq(200)\n\n expect(JSON.parse(response.body)[\"error\"]).to eq(I18n.t(\"login.not_approved\"))\n expect(session[:current_user_id]).to eq(nil)\n end", "label": 1, "label_name": "safe"} -{"code": "const globalLibvipsVersion = function () {\n if (process.platform !== 'win32') {\n const globalLibvipsVersion = spawnSync(`PKG_CONFIG_PATH=\"${pkgConfigPath()}\" pkg-config --modversion vips-cpp`, spawnSyncOptions).stdout;\n /* istanbul ignore next */\n return (globalLibvipsVersion || '').trim();\n } else {\n return '';\n }\n};", "label": 0, "label_name": "vulnerable"} -{"code": " function manage() {\r\n global $db, $router, $user;\r\n\r\n expHistory::set('manageable', $router->params);\r\n assign_to_template(array(\r\n 'canManageStandalones' => self::canManageStandalones(),\r\n 'sasections' => $db->selectObjects('section', 'parent=-1'),\r\n 'user' => $user,\r\n// 'canManagePagesets' => $user->isAdmin(),\r\n// 'templates' => $db->selectObjects('section_template', 'parent=0'),\r\n ));\r\n }\r", "label": 0, "label_name": "vulnerable"} -{"code": " unset($this->cookies[$cookie['domain']][$cookie['path']][$cookie['name']]);\n }\n\n return true;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\tprivate function convertTimestamp( $inputDate ) {\n\t\t$timestamp = $inputDate;\n\t\tswitch ( $inputDate ) {\n\t\t\tcase 'today':\n\t\t\t\t$timestamp = date( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t\tcase 'last hour':\n\t\t\t\t$date = new \\DateTime();\n\t\t\t\t$date->sub( new \\DateInterval( 'P1H' ) );\n\t\t\t\t$timestamp = $date->format( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t\tcase 'last day':\n\t\t\t\t$date = new \\DateTime();\n\t\t\t\t$date->sub( new \\DateInterval( 'P1D' ) );\n\t\t\t\t$timestamp = $date->format( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t\tcase 'last week':\n\t\t\t\t$date = new \\DateTime();\n\t\t\t\t$date->sub( new \\DateInterval( 'P7D' ) );\n\t\t\t\t$timestamp = $date->format( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t\tcase 'last month':\n\t\t\t\t$date = new \\DateTime();\n\t\t\t\t$date->sub( new \\DateInterval( 'P1M' ) );\n\t\t\t\t$timestamp = $date->format( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t\tcase 'last year':\n\t\t\t\t$date = new \\DateTime();\n\t\t\t\t$date->sub( new \\DateInterval( 'P1Y' ) );\n\t\t\t\t$timestamp = $date->format( 'YmdHis' );\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( is_numeric( $timestamp ) ) {\n\t\t\treturn $this->DB->addQuotes( $timestamp );\n\t\t}\n\t\treturn 0;\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": " void ampersand() {\n final PathAndQuery res = PathAndQuery.parse(\"/&?a=1&a=2&b=3\");\n assertThat(res).isNotNull();\n assertThat(res.path()).isEqualTo(\"/&\");\n assertThat(res.query()).isEqualTo(\"a=1&a=2&b=3\");\n\n // '%26' in a query string should never be decoded into '&'.\n final PathAndQuery res2 = PathAndQuery.parse(\"/%26?a=1%26a=2&b=3\");\n assertThat(res2).isNotNull();\n assertThat(res2.path()).isEqualTo(\"/&\");\n assertThat(res2.query()).isEqualTo(\"a=1%26a=2&b=3\");\n }", "label": 0, "label_name": "vulnerable"} -{"code": "0;k evar\n Log.add_error(request, evar)\n end\n \n attrs = ActionController::Parameters.new({status: Workflow::STATUS_ACTIVE, issued_at: Time.now})\n @workflow.update_attributes(attrs.permit(Workflow::PERMIT_BASE))\n\n @orders = @workflow.get_orders\n\n render(:partial => 'ajax_workflow', :layout => false)\n end", "label": 0, "label_name": "vulnerable"} -{"code": " recyclebin::sendToRecycleBin($loc, $parent);\r\n //FIXME if we delete the module & sectionref the module completely disappears\r\n// if (class_exists($secref->module)) {\r\n// $modclass = $secref->module;\r\n// //FIXME: more module/controller glue code\r\n// if (expModules::controllerExists($modclass)) {\r\n// $modclass = expModules::getControllerClassName($modclass);\r\n// $mod = new $modclass($loc->src);\r\n// $mod->delete_instance();\r\n// } else {\r\n// $mod = new $modclass();\r\n// $mod->deleteIn($loc);\r\n// }\r\n// }\r\n }\r\n// $db->delete('sectionref', 'section=' . $parent);\r\n $db->delete('section', 'parent=' . $parent);\r\n }\r", "label": 0, "label_name": "vulnerable"} -{"code": " public function test19176()\n {\n $foo = new Net_URL2('http://www.example.com');\n $test = $foo->resolve('test.html')->getURL();\n $this->assertEquals('http://www.example.com/test.html', $test);\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function testNormal()\n {\n $this->assertResult('\"\"');\n }", "label": 1, "label_name": "safe"} -{"code": "mxCellRenderer.prototype.destroy=function(u){D.apply(this,arguments);null!=u.secondLabel&&(u.secondLabel.destroy(),u.secondLabel=null)};mxCellRenderer.prototype.getShapesForState=function(u){return[u.shape,u.text,u.secondLabel,u.control]};var G=mxGraphView.prototype.resetValidationState;mxGraphView.prototype.resetValidationState=function(){G.apply(this,arguments);this.enumerationState=0};var P=mxGraphView.prototype.stateValidated;mxGraphView.prototype.stateValidated=function(u){null!=u.shape&&this.redrawEnumerationState(u);\nreturn P.apply(this,arguments)};mxGraphView.prototype.createEnumerationValue=function(u){u=decodeURIComponent(mxUtils.getValue(u.style,\"enumerateValue\",\"\"));\"\"==u&&(u=++this.enumerationState);return'
'+mxUtils.htmlEntities(u)+\"
\"};mxGraphView.prototype.redrawEnumerationState=function(u){var E=\"1\"==mxUtils.getValue(u.style,\"enumerate\",0);E&&null==u.secondLabel?(u.secondLabel=new mxText(\"\",new mxRectangle,mxConstants.ALIGN_LEFT,", "label": 0, "label_name": "vulnerable"} -{"code": "function get_def($DB, $table) {\n\n $def = \"### Dump table $table\\n\\n\";\n $def .= \"DROP TABLE IF EXISTS `$table`;\\n\";\n\n $query = \"SHOW CREATE TABLE `$table`\";\n $result = $DB->query($query);\n $DB->query(\"SET SESSION sql_quote_show_create = 1\");\n $row = $DB->fetch_row($result);\n\n $def .= preg_replace(\"/AUTO_INCREMENT=\\w+/i\", \"\", $row[1]);\n $def .= \";\";\n return $def.\"\\n\\n\";\n}", "label": 0, "label_name": "vulnerable"} -{"code": "openTagClose:function(b,a){var c=this._.rules[b];a?(this._.output.push(this.selfClosingEnd),c&&c.breakAfterClose&&(this._.needsSpace=c.needsSpace)):(this._.output.push(\">\"),c&&c.indent&&(this._.indentation+=this.indentationChars));c&&c.breakAfterOpen&&this.lineBreak();\"pre\"==b&&(this._.inPre=1)},attribute:function(b,a){\"string\"==typeof a&&(this.forceSimpleAmpersand&&(a=a.replace(/&/g,\"&\")),a=CKEDITOR.tools.htmlEncodeAttr(a));this._.output.push(\" \",b,'=\"',a,'\"')},closeTag:function(b){var a=this._.rules[b];\na&&a.indent&&(this._.indentation=this._.indentation.substr(this.indentationChars.length));this._.indent?this.indentation():a&&a.breakBeforeClose&&(this.lineBreak(),this.indentation());this._.output.push(\"\");\"pre\"==b&&(this._.inPre=0);a&&a.breakAfterClose&&(this.lineBreak(),this._.needsSpace=a.needsSpace);this._.afterCloser=1},text:function(b){this._.indent&&(this.indentation(),!this._.inPre&&(b=CKEDITOR.tools.ltrim(b)));this._.output.push(b)},comment:function(b){this._.indent&&this.indentation();", "label": 1, "label_name": "safe"} -{"code": " private def parseBadThing(): String = try {\n parse(\"\"\"{\"user\":\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"<}\"\"\")\n \"x\" * 1000\n } catch {\n case e: Throwable => e.getMessage\n }\n\n\n \"JSON Parser Specification\".title", "label": 1, "label_name": "safe"} -{"code": "mxCellRenderer.prototype.destroy=function(u){E.apply(this,arguments);null!=u.secondLabel&&(u.secondLabel.destroy(),u.secondLabel=null)};mxCellRenderer.prototype.getShapesForState=function(u){return[u.shape,u.text,u.secondLabel,u.control]};var G=mxGraphView.prototype.resetValidationState;mxGraphView.prototype.resetValidationState=function(){G.apply(this,arguments);this.enumerationState=0};var P=mxGraphView.prototype.stateValidated;mxGraphView.prototype.stateValidated=function(u){null!=u.shape&&this.redrawEnumerationState(u);\nreturn P.apply(this,arguments)};mxGraphView.prototype.createEnumerationValue=function(u){u=decodeURIComponent(mxUtils.getValue(u.style,\"enumerateValue\",\"\"));\"\"==u&&(u=++this.enumerationState);return'
'+mxUtils.htmlEntities(u)+\"
\"};mxGraphView.prototype.redrawEnumerationState=function(u){var D=\"1\"==mxUtils.getValue(u.style,\"enumerate\",0);D&&null==u.secondLabel?(u.secondLabel=new mxText(\"\",new mxRectangle,mxConstants.ALIGN_LEFT,", "label": 1, "label_name": "safe"} -{"code": "func (p *CompactProtocol) ReadFieldBegin() (name string, typeId Type, id int16, err error) {\n\tt, err := p.readByteDirect()\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// if it's a stop, then we can return immediately, as the struct is over.\n\tif (t & 0x0f) == STOP {\n\t\treturn \"\", STOP, 0, nil\n\t}\n\n\t// mask off the 4 MSB of the type header. it could contain a field id delta.\n\tmodifier := int16((t & 0xf0) >> 4)\n\tif modifier == 0 {\n\t\t// not a delta. look ahead for the zigzag varint field id.\n\t\tid, err = p.ReadI16()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t} else {\n\t\t// has a delta. add the delta to the last read field id.\n\t\tid = int16(p.lastFieldIDRead) + modifier\n\t}\n\ttypeId, e := p.getType(compactType(t & 0x0f))\n\tif e != nil {\n\t\terr = NewProtocolException(e)\n\t\treturn\n\t}\n\n\t// if this happens to be a boolean field, the value is encoded in the type\n\tif p.isBoolType(t) {\n\t\t// save the boolean value in a special instance variable.\n\t\tp.boolValue = (byte(t)&0x0f == COMPACT_BOOLEAN_TRUE)\n\t\tp.boolValueIsNotNull = true\n\t}\n\n\t// push the new field onto the field stack so we can keep the deltas going.\n\tp.lastFieldIDRead = int(id)\n\treturn\n}", "label": 0, "label_name": "vulnerable"} -{"code": "void CoreNetwork::putCmd(const QString &cmd, const QList> ¶ms, const QByteArray &prefix)\n{\n QListIterator> i(params);\n while (i.hasNext()) {\n QList msg = i.next();\n putCmd(cmd, msg, prefix);\n }\n}", "label": 1, "label_name": "safe"} -{"code": " public static void Reopen(string accountCode)\n {\n // PUT /accounts//reopen\n Client.Instance.PerformRequest(Client.HttpRequestMethod.Put,\n Account.UrlPrefix + Uri.EscapeDataString(accountCode) + \"/reopen\");\n }", "label": 1, "label_name": "safe"} -{"code": " public function checkAuthorisation($id, $user, $write)\n {\n // fetch the bare template\n $template = $this->find('first', array(\n 'conditions' => array('id' => $id),\n 'recursive' => -1,\n ));\n\n // if not found return false\n if (empty($template)) {\n return false;\n }\n\n //if the user is a site admin, return the template withoug question\n if ($user['Role']['perm_site_admin']) {\n return $template;\n }\n\n if ($write) {\n // if write access is requested, check if template belongs to user's org and whether the user is authorised to edit templates\n if ($user['Organisation']['name'] == $template['Template']['org'] && $user['Role']['perm_template']) {\n return $template;\n }\n return false;\n } else {\n\n // if read access is requested, check if the template belongs to the user's org or alternatively whether the template is shareable\n if ($user['Organisation']['name'] == $template['Template']['org'] || $template['Template']['share']) {\n return $template;\n }\n return false;\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": "lspci_process(STREAM s)\n{\n\tunsigned int pkglen;\n\tstatic char *rest = NULL;\n\tchar *buf;\n\tstruct stream packet = *s;\n\n\tif (!s_check(s))\n\t{\n\t\trdp_protocol_error(\"lspci_process(), stream is in unstable state\", &packet);\n\t}\n\n\tpkglen = s->end - s->p;\n\t/* str_handle_lines requires null terminated strings */\n\tbuf = xmalloc(pkglen + 1);\n\tSTRNCPY(buf, (char *) s->p, pkglen + 1);\n\tstr_handle_lines(buf, &rest, lspci_process_line, NULL);\n\txfree(buf);\n}", "label": 1, "label_name": "safe"} -{"code": " it \"adds the credentials to the auth cache\" do\n socket.login(:admin, \"username\", \"password\")\n socket.auth.should eq(\"admin\" => [\"username\", \"password\"])\n end", "label": 0, "label_name": "vulnerable"} -{"code": " public function validateId($id)\n {\n $id_string = $id->toString();\n $this->context[] = \"id '$id_string'\";\n if (!$id instanceof HTMLPurifier_ConfigSchema_Interchange_Id) {\n // handled by InterchangeBuilder\n $this->error(false, 'is not an instance of HTMLPurifier_ConfigSchema_Interchange_Id');\n }\n // keys are now unconstrained (we might want to narrow down to A-Za-z0-9.)\n // we probably should check that it has at least one namespace\n $this->with($id, 'key')\n ->assertNotEmpty()\n ->assertIsString(); // implicit assertIsString handled by InterchangeBuilder\n array_pop($this->context);\n }", "label": 1, "label_name": "safe"} -{"code": " public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n try {\n UserFactory.init();\n } catch (Throwable e) {\n throw new ServletException(\"AddNewUserServlet: Error initialising user factory.\" + e);\n }\n UserManager userFactory = UserFactory.getInstance();\n\n String userID = request.getParameter(\"userID\");\n\n if (userID != null && userID.matches(\".*[&<>\\\"`']+.*\")) {\n throw new ServletException(\"User ID must not contain any HTML markup.\");\n }\n\n String password = request.getParameter(\"pass1\");\n\n boolean hasUser = false;\n try {\n hasUser = userFactory.hasUser(userID);\n } catch (Throwable e) {\n throw new ServletException(\"can't determine if user \" + userID + \" already exists in users.xml.\", e);\n }\n\n if (hasUser) {\n RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher(\"/admin/userGroupView/users/newUser.jsp?action=redo\");\n dispatcher.forward(request, response);\n } else {\n final Password pass = new Password();\n pass.setEncryptedPassword(UserFactory.getInstance().encryptedPassword(password, true));\n pass.setSalt(true);\n\n final User newUser = new User();\n newUser.setUserId(userID);\n newUser.setPassword(pass);\n\n final HttpSession userSession = request.getSession(false);\n userSession.setAttribute(\"user.modifyUser.jsp\", newUser);\n\n // forward the request for proper display\n RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher(\"/admin/userGroupView/users/modifyUser.jsp\");\n dispatcher.forward(request, response);\n }\n }", "label": 1, "label_name": "safe"} -{"code": "static void _perf_event_reset(struct perf_event *event)\n{\n\t(void)perf_event_read(event);\n\tlocal64_set(&event->count, 0);\n\tperf_event_update_userpage(event);\n}", "label": 1, "label_name": "safe"} -{"code": " def test_oauth_login_next(self):\n \"\"\"\n OAuth: Test login next\n \"\"\"\n client = self.app.test_client()\n\n self.appbuilder.sm.oauth_remotes = {\"google\": OAuthRemoteMock()}\n\n raw_state = {\"next\": [\"http://localhost/users/list/\"]}\n state = jwt.encode(raw_state, self.app.config[\"SECRET_KEY\"], algorithm=\"HS256\")\n\n response = client.get(f\"/oauth-authorized/google?state={state.decode('utf-8')}\")\n self.assertEqual(response.location, \"http://localhost/users/list/\")", "label": 1, "label_name": "safe"} -{"code": " public function configure() {\n $this->config['defaultbanner'] = array();\n if (!empty($this->config['defaultbanner_id'])) {\n $this->config['defaultbanner'][] = new expFile($this->config['defaultbanner_id']);\n }\n\t parent::configure();\n\t $banners = $this->banner->find('all', null, 'companies_id');\n\t assign_to_template(array(\n 'banners'=>$banners,\n 'title'=>static::displayname()\n ));\n\t}", "label": 1, "label_name": "safe"} -{"code": " foreach ($mergedPermissions as $mergedPermission => $value) {\n // Strip the '*' off the beginning of the permission.\n $checkPermission = substr($permission, 1);\n\n // We will make sure that the merged permission does not\n // exactly match our permission, but ends with it.\n if ($checkPermission != $mergedPermission && ends_with($mergedPermission, $checkPermission) && $value === 1) {\n $matched = true;\n break;\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": " eval: function (env) {\n var that = this;\n var value = this.value.replace(/`([^`]+)`/g, function (_, exp) {\n return new(tree.JavaScript)(exp, that.index, true).eval(env).value;\n }).replace(/@\\{([\\w-]+)\\}/g, function (_, name) {\n var v = new(tree.Variable)('@' + name, that.index, that.currentFileInfo).eval(env, true);\n return (v instanceof tree.Quoted) ? v.value : v.toCSS();\n });\n return new(tree.Quoted)(this.quote + value + this.quote, value, this.escaped, this.index, this.currentFileInfo);\n },", "label": 0, "label_name": "vulnerable"} -{"code": " def loadMyPageData(pageIds: St): Action[U] = GetAction2(RateLimits.ReadsFromDb,\n MinAuthnStrength.EmbeddingStorageSid12) { request =>", "label": 1, "label_name": "safe"} -{"code": "static RList *r_bin_wasm_get_global_entries (RBinWasmObj *bin, RBinWasmSection *sec) {\n\tRList *ret = NULL;\n\tRBinWasmGlobalEntry *ptr = NULL;\n\tint buflen = bin->buf->length;\n\tif (sec->payload_data + 32 > buflen) {\n\t\treturn NULL;\n\t}\n\n\tif (!(ret = r_list_newf ((RListFree)free))) {\n\t\treturn NULL;\n\t}\n\n\tut8* buf = bin->buf->buf + (ut32)sec->payload_data;\n\tut32 len = sec->payload_len;\n\tut32 count = sec->count;\n\tut32 i = 0, r = 0;\n\n\twhile (i < len && len < buflen && r < count) {\n\t\tif (!(ptr = R_NEW0 (RBinWasmGlobalEntry))) {\n\t\t\treturn ret;\n\t\t}\n\n\t\tif (len + 8 > buflen || !(consume_u8 (buf + i, buf + len, (ut8*)&ptr->content_type, &i))) {\n\t\t\tgoto beach;\n\t\t}\n\t\tif (len + 8 > buflen || !(consume_u8 (buf + i, buf + len, &ptr->mutability, &i))) {\n\t\t\tgoto beach;\n\t\t}\n\t\tif (len + 8 > buflen || !(consume_init_expr (buf + i, buf + len, R_BIN_WASM_END_OF_CODE, NULL, &i))) {\n\t\t\tgoto beach;\n\t\t}\n\t\tr_list_append (ret, ptr);\n\t\tr++;\n\t}\n\treturn ret;\nbeach:\n\tfree (ptr);\n\treturn ret;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function getMimetype()\n {\n return $this->filesystem->getMimetype($this->path);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "mxResources.get(\"ok\"),ba,fa,function(oa){var na=null!=oa&&0factory = HTMLPurifier_LanguageFactory::instance();\n parent::setUp();\n }", "label": 1, "label_name": "safe"} -{"code": "GraphViewer.processElements = function(classname)\n{\n\tmxUtils.forEach(GraphViewer.getElementsByClassName(classname || 'mxgraph'), function(div)\n\t{\n\t\ttry\n\t\t{\n\t\t\tdiv.innerText = '';\n\t\t\tGraphViewer.createViewerForElement(div);\n\t\t}\n\t\tcatch (e)\n\t\t{\n\t\t\tdiv.innerHTML = e.message;\n\t\t\t\n\t\t\tif (window.console != null)\n\t\t\t{\n\t\t\t\tconsole.error(e);\n\t\t\t}\n\t\t}\n\t});\n};", "label": 1, "label_name": "safe"} -{"code": "\tfunction notify($event) {\n\n\t\t$this->messages[] = $event;\n\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": " def branches\n at_path { git_with_identity('branch', '-a') }.gsub('*', ' ').split(/\\n/).map { |line| line.strip }\n end", "label": 0, "label_name": "vulnerable"} -{"code": "!0,0,mxUtils.bind(this,function(e){this.hsplitPosition=e;this.refresh()})))};EditorUi.prototype.createStatusContainer=function(){var b=document.createElement(\"a\");b.className=\"geItem geStatus\";return b};EditorUi.prototype.setStatusText=function(b){this.statusContainer.innerHTML=b;0==this.statusContainer.getElementsByTagName(\"div\").length&&(this.statusContainer.innerHTML=\"\",b=this.createStatusDiv(b),this.statusContainer.appendChild(b))};", "label": 0, "label_name": "vulnerable"} -{"code": " it 'creates a new ongoing campaign' do\n post \"/api/v1/accounts/#{account.id}/campaigns\",\n params: { inbox_id: inbox.id, title: 'test', message: 'test message', trigger_rules: { url: 'https://test.com' } },\n headers: administrator.create_new_auth_token,\n as: :json\n\n expect(response).to have_http_status(:success)\n expect(JSON.parse(response.body, symbolize_names: true)[:title]).to eq('test')\n end", "label": 1, "label_name": "safe"} -{"code": "static void hugetlb_vm_op_close(struct vm_area_struct *vma)\n{\n\tstruct hstate *h = hstate_vma(vma);\n\tstruct resv_map *reservations = vma_resv_map(vma);\n\tstruct hugepage_subpool *spool = subpool_vma(vma);\n\tunsigned long reserve;\n\tunsigned long start;\n\tunsigned long end;\n\n\tif (reservations) {\n\t\tstart = vma_hugecache_offset(h, vma, vma->vm_start);\n\t\tend = vma_hugecache_offset(h, vma, vma->vm_end);\n\n\t\treserve = (end - start) -\n\t\t\tregion_count(&reservations->regions, start, end);\n\n\t\tkref_put(&reservations->refs, resv_map_release);\n\n\t\tif (reserve) {\n\t\t\thugetlb_acct_memory(h, -reserve);\n\t\t\thugepage_subpool_put_pages(spool, reserve);\n\t\t}\n\t}\n}", "label": 0, "label_name": "vulnerable"} -{"code": "async def account_register_post(\n request: Request,\n U: str = Form(default=str()), # Username\n E: str = Form(default=str()), # Email\n H: str = Form(default=\"off\"), # Hide Email\n BE: str = Form(default=None), # Backup Email\n R: str = Form(default=\"\"), # Real Name\n HP: str = Form(default=None), # Homepage\n I: str = Form(default=None), # IRC Nick # noqa: E741\n K: str = Form(default=None), # PGP Key\n L: str = Form(default=aurweb.config.get(\"options\", \"default_lang\")),\n TZ: str = Form(default=aurweb.config.get(\"options\", \"default_timezone\")),\n PK: str = Form(default=None), # SSH PubKey\n CN: bool = Form(default=False),\n UN: bool = Form(default=False),\n ON: bool = Form(default=False),\n captcha: str = Form(default=None),\n captcha_salt: str = Form(...),", "label": 1, "label_name": "safe"} -{"code": "TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {\n const TfLiteTensor* input = GetInput(context, node, 0);\n TfLiteTensor* output_index_tensor = GetOutput(context, node, 1);\n TF_LITE_ENSURE_EQ(context, NumElements(output_index_tensor),\n NumElements(input));\n\n switch (input->type) {\n case kTfLiteInt8:\n TF_LITE_ENSURE_STATUS(EvalImpl(context, input, node));\n break;\n case kTfLiteInt16:\n TF_LITE_ENSURE_STATUS(EvalImpl(context, input, node));\n break;\n case kTfLiteInt32:\n TF_LITE_ENSURE_STATUS(EvalImpl(context, input, node));\n break;\n case kTfLiteInt64:\n TF_LITE_ENSURE_STATUS(EvalImpl(context, input, node));\n break;\n case kTfLiteFloat32:\n TF_LITE_ENSURE_STATUS(EvalImpl(context, input, node));\n break;\n case kTfLiteUInt8:\n TF_LITE_ENSURE_STATUS(EvalImpl(context, input, node));\n break;\n default:\n context->ReportError(context, \"Currently Unique doesn't support type: %s\",\n TfLiteTypeGetName(input->type));\n return kTfLiteError;\n }\n return kTfLiteOk;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "void AnnotateIgnoreWritesBegin(const char *file, int line){}", "label": 0, "label_name": "vulnerable"} -{"code": "ka.size,ua,sa)):\"readOnly\"==wa?(sa=document.createElement(\"input\"),sa.setAttribute(\"readonly\",\"\"),sa.value=ta,sa.style.width=\"96px\",sa.style.borderWidth=\"0px\",xa.appendChild(sa)):(xa.innerHTML=mxUtils.htmlEntities(decodeURIComponent(ta)),mxEvent.addListener(xa,\"click\",mxUtils.bind(Z,function(){function da(){var la=ca.value;la=0==la.length&&\"string\"!=wa?0:la;ka.allowAuto&&(null!=la.trim&&\"auto\"==la.trim().toLowerCase()?(la=\"auto\",wa=\"string\"):(la=parseFloat(la),la=isNaN(la)?0:la));null!=ka.min&&la<\nka.min?la=ka.min:null!=ka.max&&la>ka.max&&(la=ka.max);la=encodeURIComponent((\"int\"==wa?parseInt(la):la)+\"\");T(Aa,la,ka)}var ca=document.createElement(\"input\");N(xa,ca,!0);ca.value=decodeURIComponent(ta);ca.className=\"gePropEditor\";\"int\"!=wa&&\"float\"!=wa||ka.allowAuto||(ca.type=\"number\",ca.step=\"int\"==wa?\"1\":\"any\",null!=ka.min&&(ca.min=parseFloat(ka.min)),null!=ka.max&&(ca.max=parseFloat(ka.max)));u.appendChild(ca);mxEvent.addListener(ca,\"keypress\",function(la){13==la.keyCode&&da()});ca.focus();mxEvent.addListener(ca,", "label": 0, "label_name": "vulnerable"} -{"code": "func ensureBasePath(root, base, target string) (string, error) {\n\tpath, err := filepath.Rel(base, target)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tcleanPath := filepath.ToSlash(filepath.Clean(path))\n\tif cleanPath == \"..\" || strings.HasPrefix(cleanPath, \"../\") {\n\t\treturn \"\", fmt.Errorf(\"%q is outside of %q\", target, base)\n\t}\n\n\t// No symbolic link allowed in the relative path\n\tdir := filepath.Dir(path)\n\tfor dir != \".\" {\n\t\tif info, err := os.Lstat(filepath.Join(root, dir)); err != nil {\n\t\t\tif !os.IsNotExist(err) {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t} else if info.Mode()&os.ModeSymlink != 0 {\n\t\t\treturn \"\", fmt.Errorf(\"no symbolic link allowed between %q and %q\", base, target)\n\t\t}\n\t\tdir = filepath.Dir(dir)\n\t}\n\n\treturn path, nil\n}", "label": 1, "label_name": "safe"} -{"code": "void Mounter::startTimer()\n{\n if (!timer) {\n timer=new QTimer(this);\n connect(timer, SIGNAL(timeout()), SLOT(timeout()));\n }\n timer->start(30000);\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function add($def, $config)\n {\n return false;\n }", "label": 1, "label_name": "safe"} -{"code": " public function manage_messages() {\n expHistory::set('manageable', $this->params);\n\n $page = new expPaginator(array(\n\t\t\t'model'=>'order_status_messages',\n\t\t\t'where'=>1,\n 'limit'=>10,\n\t\t\t'order'=>'body',\n 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),\n 'controller'=>$this->params['controller'],\n 'action'=>$this->params['action'],\n\t\t\t//'columns'=>array('Name'=>'title')\n ));\n\n //eDebug($page);\n\t\tassign_to_template(array(\n 'page'=>$page\n ));\n }", "label": 1, "label_name": "safe"} -{"code": "CbrDetectorRemote::Result CbrDetectorRemote::Decrypt(cricket::MediaType media_type,\n\t\t\t\t\t\tconst std::vector& csrcs,\n\t\t\t\t\t\trtc::ArrayView additional_data,\n\t\t\t\t\t\trtc::ArrayView encrypted_frame,\n\t\t\t\t\t\trtc::ArrayView frame)\n{\n\tconst uint8_t *src = encrypted_frame.data();\n\tuint8_t *dst = frame.data();\n\tuint32_t data_len = encrypted_frame.size();\n\n\tif (media_type == cricket::MEDIA_TYPE_AUDIO) {\n\t\tif (data_len == frame_size && frame_size >= 40) {\n\t\t\tmissmatch_count = 0;\n\t\t\tframe_count++;\n\t\t\tif (frame_count > MIN_MATCH && !detected) {\n\t\t\t\tinfo(\"CBR detector: remote cbr detected\\n\");\n\t\t\t\tdetected = true;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tmissmatch_count++;\n\t\t\tif (!detected\n\t\t\t || (detected && missmatch_count > MAX_MISSMATCH)) {\n\t\t\t\tframe_count = 0;\n\t\t\t\tframe_size = data_len;\n\t\t\t\tmissmatch_count = 0;\n\t\t\t\tif (detected) {\n\t\t\t\t\tinfo(\"CBR detector: remote cbr detected disabled\\n\");\n\t\t\t\t\tdetected = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tmemcpy(dst, src, data_len);\n\nout:\n\treturn CbrDetectorRemote::Result(CbrDetectorRemote::Status::kOk, data_len);\n}", "label": 1, "label_name": "safe"} -{"code": "fn should_disallow_non_get_requests() {\n\t// given\n\tlet (server, fetch) = serve_with_fetch(\"token\", \"https://parity.io\");\n\n\t// when\n\tlet response = request(server,\n\t\t\"\\\n\t\t\tPOST / HTTP/1.1\\r\\n\\\n\t\t\tHost: EHQPPSBE5DM78X3GECX2YBVGC5S6JX3S5SMPY.web.web3.site\\r\\n\\\n\t\t\tContent-Type: application/json\\r\\n\\\n\t\t\tConnection: close\\r\\n\\\n\t\t\t\\r\\n\\\n\t\t\t123\\r\\n\\\n\t\t\t\\r\\n\\\n\t\t\"\n\t);\n\n\t// then\n\tresponse.assert_status(\"HTTP/1.1 405 Method Not Allowed\");\n\tassert_security_headers_for_embed(&response.headers);\n\n\tfetch.assert_no_more_requests();\n}", "label": 1, "label_name": "safe"} -{"code": " def test_equal_body(self):\n # check server doesnt close connection when body is equal to\n # cl header\n to_send = tobytes(\n \"GET /equal_body HTTP/1.0\\n\"\n \"Connection: Keep-Alive\\n\"\n \"Content-Length: 0\\n\"\n \"\\n\"\n )\n self.connect()\n self.sock.send(to_send)\n fp = self.sock.makefile(\"rb\", 0)\n line, headers, response_body = read_http(fp)\n content_length = int(headers.get(\"content-length\")) or None\n self.assertEqual(content_length, 9)\n self.assertline(line, \"200\", \"OK\", \"HTTP/1.0\")\n self.assertEqual(content_length, len(response_body))\n self.assertEqual(response_body, tobytes(\"abcdefghi\"))\n # remote does not close connection (keepalive header)\n self.sock.send(to_send)\n fp = self.sock.makefile(\"rb\", 0)\n line, headers, response_body = read_http(fp)\n self.assertline(line, \"200\", \"OK\", \"HTTP/1.0\")", "label": 0, "label_name": "vulnerable"} -{"code": " var doSynchronize = function(requisition, rescanExisting) {\n RequisitionsService.startTiming();\n RequisitionsService.synchronizeRequisition(requisition.foreignSource, rescanExisting).then(\n function() { // success\n growl.success('The import operation has been started for ' + requisition.foreignSource + ' (rescanExisting? ' + rescanExisting + ')
Use refresh to update the deployed statistics');\n requisition.setDeployed(true);\n },\n errorHandler\n );\n };", "label": 0, "label_name": "vulnerable"} -{"code": "init_ext2_xattr(void)\n{\n\treturn 0;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "\tprotected function removeNetVolume($key) {\n\t\t$netVolumes = $this->getNetVolumes();\n\t\tif (is_string($key) && isset($netVolumes[$key])) {\n\t\t\tunset($netVolumes[$key]);\n\t\t\t$this->saveNetVolumes($netVolumes);\n\t\t}\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic function getPrintAndMailLink($icmsObj) {\r\n\t\tglobal $icmsConfig, $impresscms;\r\n\r\n\t\t$ret = '';\r\n\t\t/*\t\t$printlink = $this->handler->_moduleUrl . \"print.php?\" . $this->handler->keyName . \"=\" . $icmsObj->getVar($this->handler->keyName);\r\n\t\t $js = \"javascript:openWithSelfMain('\" . $printlink . \"', 'smartpopup', 700, 519);\";\r\n\t\t $printlink = '\"\"';\r\n\r\n\t\t $icmsModule = icms_getModuleInfo($icmsObj->handler->_moduleName);\r\n\t\t $link = $impresscms->urls['full']();\r\n\t\t $mid = $icmsModule->getVar('mid');\r\n\t\t $friendlink = \"\\\"\"\";\r\n\r\n\t\t $ret = '' . $printlink . \" \" . '' . $friendlink . '';\r\n\t\t */\r\n\t\treturn $ret;\r\n\t}\r", "label": 0, "label_name": "vulnerable"} -{"code": " window._load_metadata = function(ev, viewport) {\n\n /* Image details */\n var tmp = viewport.getMetadata();\n $('#wblitz-image-name').html(tmp.imageName.escapeHTML());\n $('#wblitz-image-description-content').html(tmp.imageDescription.escapeHTML().replace(/\\n/g, '
'));\n $('#wblitz-image-author').html(tmp.imageAuthor.escapeHTML());\n $('#wblitz-image-pub').html(tmp.projectName.escapeHTML());\n $('#wblitz-image-pubid').html(tmp.projectId);\n $('#wblitz-image-timestamp').html(tmp.imageTimestamp);\n\n $(\"#bulk-annotations\").hide();\n $(\"#bulk-annotations\").next().hide();\n if (tmp.wellId) {\n\n var wellsUrl = PLATE_WELLS_URL_999.replace('999', tmp.wellId),\n linksUrl = PLATE_LINKS_URL_999.replace('999', tmp.wellId);\n loadBulkAnnotations(wellsUrl, 'Well-' + tmp.wellId);\n loadBulkAnnotations(linksUrl, 'Well-' + tmp.wellId);\n }\n };", "label": 1, "label_name": "safe"} -{"code": "TEST_P(SslSocketTest, FailedClientAuthSanVerification) {\n const std::string client_ctx_yaml = R\"EOF(\n common_tls_context:\n tls_certificates:\n certificate_chain:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/no_san_cert.pem\"\n private_key:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/no_san_key.pem\"\n)EOF\";\n\n const std::string server_ctx_yaml = R\"EOF(\n common_tls_context:\n tls_certificates:\n certificate_chain:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_cert.pem\"\n private_key:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/unittest_key.pem\"\n validation_context:\n trusted_ca:\n filename: \"{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/ca_cert.pem\"\n match_subject_alt_names:\n exact: \"example.com\"\n)EOF\";\n\n TestUtilOptions test_options(client_ctx_yaml, server_ctx_yaml, false, GetParam());\n testUtil(test_options.setExpectedServerStats(\"ssl.fail_verify_san\"));\n}", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic function Insert()\n\t{\n\t\t$ins_stmt = Database::prepare(\"\n\t\t\tINSERT INTO `\" . TABLE_PANEL_TICKETS . \"` SET\n `customerid` = :customerid,\n `adminid` = :adminid,\n `category` = :category,\n `priority` = :priority,\n `subject` = :subject,\n `message` = :message,\n `dt` = :dt,\n `lastchange` = :lastchange,\n `ip` = :ip,\n `status` = :status,\n `lastreplier` = :lastreplier,\n `by` = :by,\n `answerto` = :answerto\");\n\t\t$ins_data = array(\n\t\t\t'customerid' => $this->Get('customer'),\n\t\t\t'adminid' => $this->Get('admin'),\n\t\t\t'category' => $this->Get('category'),\n\t\t\t'priority' => $this->Get('priority'),\n\t\t\t'subject' => $this->Get('subject'),\n\t\t\t'message' => $this->Get('message'),\n\t\t\t'dt' => time(),\n\t\t\t'lastchange' => time(),\n\t\t\t'ip' => $this->Get('ip'),\n\t\t\t'status' => $this->Get('status'),\n\t\t\t'lastreplier' => $this->Get('lastreplier'),\n\t\t\t'by' => $this->Get('by'),\n\t\t\t'answerto' => $this->Get('answerto')\n\t\t);\n\t\tDatabase::pexecute($ins_stmt, $ins_data);\n\t\t$this->tid = Database::lastInsertId();\n\t\treturn true;\n\t}", "label": 1, "label_name": "safe"} -{"code": " it 'returns a charset' do\n instance.charset.should == 'latin1'\n end", "label": 0, "label_name": "vulnerable"} -{"code": " public function testReplaceArgumentShouldCheckBounds()\n {\n $def = new Definition('stdClass');\n\n $def->addArgument('foo');\n $def->replaceArgument(1, 'bar');\n }", "label": 0, "label_name": "vulnerable"} -{"code": "AP4_AvccAtom::InspectFields(AP4_AtomInspector& inspector)\n{\n inspector.AddField(\"Configuration Version\", m_ConfigurationVersion);\n const char* profile_name = GetProfileName(m_Profile);\n if (profile_name) {\n inspector.AddField(\"Profile\", profile_name);\n } else {\n inspector.AddField(\"Profile\", m_Profile);\n }\n inspector.AddField(\"Profile Compatibility\", m_ProfileCompatibility, AP4_AtomInspector::HINT_HEX);\n inspector.AddField(\"Level\", m_Level);\n inspector.AddField(\"NALU Length Size\", m_NaluLengthSize);\n for (unsigned int i=0; inum_values + 1);\n\n int j;\n for (j = 0; j < a->num_values; j++)\n {\n\tbody[j] = XMALLOC(VarLenData, 1);\n\tbody[j]->len = a->values[j].len;\n\tbody[j]->data = CHECKED_XCALLOC(unsigned char, a->values[j].len);\n\tmemmove (body[j]->data, a->values[j].data.buf, body[j]->len);\n }\n return body;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "static int pn_recvmsg(struct kiocb *iocb, struct sock *sk,\n\t\t\tstruct msghdr *msg, size_t len, int noblock,\n\t\t\tint flags, int *addr_len)\n{\n\tstruct sk_buff *skb = NULL;\n\tstruct sockaddr_pn sa;\n\tint rval = -EOPNOTSUPP;\n\tint copylen;\n\n\tif (flags & ~(MSG_PEEK|MSG_TRUNC|MSG_DONTWAIT|MSG_NOSIGNAL|\n\t\t\tMSG_CMSG_COMPAT))\n\t\tgoto out_nofree;\n\n\tif (addr_len)\n\t\t*addr_len = sizeof(sa);\n\n\tskb = skb_recv_datagram(sk, flags, noblock, &rval);\n\tif (skb == NULL)\n\t\tgoto out_nofree;\n\n\tpn_skb_get_src_sockaddr(skb, &sa);\n\n\tcopylen = skb->len;\n\tif (len < copylen) {\n\t\tmsg->msg_flags |= MSG_TRUNC;\n\t\tcopylen = len;\n\t}\n\n\trval = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copylen);\n\tif (rval) {\n\t\trval = -EFAULT;\n\t\tgoto out;\n\t}\n\n\trval = (flags & MSG_TRUNC) ? skb->len : copylen;\n\n\tif (msg->msg_name != NULL)\n\t\tmemcpy(msg->msg_name, &sa, sizeof(struct sockaddr_pn));\n\nout:\n\tskb_free_datagram(sk, skb);\n\nout_nofree:\n\treturn rval;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " $scope.provision = function() {\n $scope.isSaving = true;\n growl.info($sanitize('The node ' + $scope.node.nodeLabel + ' is being added to requisition ' + $scope.node.foreignSource + '. Please wait...'));\n var successMessage = $sanitize('The node ' + $scope.node.nodeLabel + ' has been added to requisition ' + $scope.node.foreignSource);\n RequisitionsService.quickAddNode($scope.node).then(\n function() { // success\n $scope.reset();\n bootbox.dialog({\n message: successMessage,\n title: 'Success',\n buttons: {\n main: {\n label: 'Ok',\n className: 'btn-secondary'\n }\n }\n });\n },\n $scope.errorHandler\n );\n };", "label": 0, "label_name": "vulnerable"} -{"code": " public function testRegisteredEvent()\n {\n $this->assertEquals(\n array(KernelEvents::REQUEST => 'onKernelRequest'),\n AddRequestFormatsListener::getSubscribedEvents()\n );\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function testMagicSetGet()\n {\n $url = new Net_URL2('');\n\n $property = 'authority';\n $url->$property = $value = 'value';\n $this->assertEquals($value, $url->$property);\n\n $property = 'unsetProperty';\n $url->$property = $value;\n $this->assertEquals(false, $url->$property);\n }", "label": 0, "label_name": "vulnerable"} -{"code": " it \"sets the request id\" do\n reply.request_id.should eq 1\n end", "label": 0, "label_name": "vulnerable"} -{"code": " it 'should have loopback network (127.0.0.0)' do\n expect(subject.call(['127.0.0.1'])).to be_truthy\n end", "label": 0, "label_name": "vulnerable"} -{"code": " value = value.replace(/href=\" *javascript\\:(.*?)\"/gi, function(m, $1) {\n return 'removed=\"\"';\n });", "label": 1, "label_name": "safe"} -{"code": " this.disableChatSoundAdmin = function(inst)\n {\n if (inst.prop('tagName') != 'I') {\n inst = inst.find('> i.material-icons');\n }\n\n \tif (inst.text() == 'volume_off'){\n \t\t$.get(this.wwwDir+ 'user/setsettingajax/chat_message/1');\n \t\tconfLH.new_message_sound_admin_enabled = 1;\n \t\tinst.text('volume_up');\n \t} else {\n \t\t$.get(this.wwwDir+ 'user/setsettingajax/chat_message/0');\n \t\tconfLH.new_message_sound_admin_enabled = 0;\n \t\tinst.text('volume_off');\n \t}\n \treturn false;\n };", "label": 0, "label_name": "vulnerable"} -{"code": " public function __construct(HttpKernelInterface $kernel, Request $request, $requestType, \\Exception $e)\n {\n parent::__construct($kernel, $request, $requestType);\n\n $this->setException($e);\n }", "label": 0, "label_name": "vulnerable"} -{"code": " it \"can sort documents\" do\n session[:people].insert([{name: \"John\"}, {name: \"Mary\"}])\n session[:people].find.sort(_id: -1).first[\"name\"].should eq \"Mary\"\n end", "label": 0, "label_name": "vulnerable"} -{"code": " public RecurlyList GetNotes()\n {\n return new NoteList(UrlPrefix + Uri.EscapeUriString(AccountCode) + \"/notes/\");\n }", "label": 0, "label_name": "vulnerable"} -{"code": "this.$.appendChild(a.$);return a},appendHtml:function(a){if(this.$.childNodes.length){var b=new CKEDITOR.dom.element(\"div\",this.getDocument());b.setHtml(a);b.moveChildren(this)}else this.setHtml(a)},appendText:function(a){this.$.text!=void 0?this.$.text=this.$.text+a:this.append(new CKEDITOR.dom.text(a))},appendBogus:function(a){if(a||CKEDITOR.env.needsBrFiller||CKEDITOR.env.opera){for(a=this.getLast();a&&a.type==CKEDITOR.NODE_TEXT&&!CKEDITOR.tools.rtrim(a.getText());)a=a.getPrevious();if(!a||!a.is||", "label": 1, "label_name": "safe"} -{"code": " public static function navtojson() {\n return json_encode(self::navhierarchy());\n }", "label": 1, "label_name": "safe"} -{"code": "\tpublic Map> getCustomConfig(CourseEnvironment courseEnvironment){\n\t\tMap> defaultConf = new HashMap<>();\n\t\tVFSContainer base = (VFSContainer) courseEnvironment.getCourseBaseContainer().resolve(CourseLayoutHelper.LAYOUT_COURSE_SUBFOLDER);\n\t\tif (base == null) {\n\t\t\treturn defaultConf;\n\t\t}\n\t\tVFSContainer themeBase = (VFSContainer) base.resolve(\"/\" + CourseLayoutHelper.CONFIG_KEY_CUSTOM);\n\t\tif (themeBase == null) {\n\t\t\treturn defaultConf;\n\t\t}\n\t\tVFSLeaf configTarget = (VFSLeaf) themeBase.resolve(CUSTOM_CONFIG_XML);\n\t\tif (configTarget == null) {\n\t\t\treturn defaultConf;\n\t\t}\n\t\ttry(InputStream in=configTarget.getInputStream()) {\n\t\t\treturn (Map>) xstream.fromXML(in);\n\t\t} catch(IOException e) {\n\t\t\tlog.error(\"\", e);\n\t\t\treturn defaultConf;\n\t\t}\n\t}", "label": 1, "label_name": "safe"} -{"code": "\tpublic function ls($hash, $intersect = null) {\n\t\tif (($dir = $this->dir($hash)) == false || !$dir['read']) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t$list = array();\n\t\t$path = $this->decode($hash);\n\t\t\n\t\t$check = array();\n\t\tif ($intersect) {\n\t\t\t$check = array_flip($intersect);\n\t\t}\n\t\t\n\t\tforeach ($this->getScandir($path) as $stat) {\n\t\t\tif (empty($stat['hidden']) && (!$check || isset($check[$stat['name']])) && $this->mimeAccepted($stat['mime'])) {\n\t\t\t\t$list[$stat['hash']] = $stat['name'];\n\t\t\t}\n\t\t}\n\n\t\treturn $list;\n\t}", "label": 1, "label_name": "safe"} -{"code": "!1;null!=H&&(S=\"1\"==y.getCurrentCellStyle(H).treeMoving);return S}function t(H){var S=!1;null!=H&&(H=A.getParent(H),S=y.view.getState(H),S=\"tree\"==(null!=S?S.style:y.getCellStyle(H)).containerType);return S}function D(H){var S=!1;null!=H&&(H=A.getParent(H),S=y.view.getState(H),y.view.getState(H),S=null!=(null!=S?S.style:y.getCellStyle(H)).childLayout);return S}function c(H){H=y.view.getState(H);if(null!=H){var S=y.getIncomingTreeEdges(H.cell);if(0data[$name] = $value;\n }", "label": 1, "label_name": "safe"} -{"code": " get: function(name, del){\r\n // #ifdef debug\r\n this._trace(\"retrieving function \" + name);\r\n // #endif\r\n if (!_map.hasOwnProperty(name)) {\r\n return;\r\n }\r\n var fn = _map[name];\r\n // #ifdef debug\r\n if (!fn) {\r\n this._trace(name + \" not found\");\r\n }\r\n // #endif\r\n \r\n if (del) {\r\n delete _map[name];\r\n }\r\n return fn;\r\n }\r", "label": 1, "label_name": "safe"} -{"code": "\t\tformat: function (element, content) {\n\t\t\tvar author = '',\n\t\t\t\t$elm = $(element),\n\t\t\t\t$cite = $elm.children('cite').first();\n\t\t\t$cite.html($cite.text());\n\n\t\t\tif ($cite.length === 1 || $elm.data('author')) {\n\t\t\t\tauthor = $cite.text() || $elm.data('author');\n\n\t\t\t\t$elm.data('author', author);\n\t\t\t\t$cite.remove();\n\n\t\t\t\tcontent = this.elementToBbcode(element);\n\t\t\t\tauthor = '=' + author.replace(/(^\\s+|\\s+$)/g, '');\n\n\t\t\t\t$elm.prepend($cite);\n\t\t\t}\n\n\t\t\tif ($elm.data('pid'))\n\t\t\t\tauthor += \" pid='\" + $elm.data('pid') + \"'\";\n\n\t\t\tif ($elm.data('dateline'))\n\t\t\t\tauthor += \" dateline='\" + $elm.data('dateline') + \"'\";\n\n\t\t\treturn '[quote' + author + ']' + content + '[/quote]';\n\t\t},", "label": 0, "label_name": "vulnerable"} -{"code": "check_lnums_both(int do_curwin, int nested)\n{\n win_T\t*wp;\n tabpage_T\t*tp;\n\n FOR_ALL_TAB_WINDOWS(tp, wp)\n\tif ((do_curwin || wp != curwin) && wp->w_buffer == curbuf)\n\t{\n\t if (!nested)\n\t {\n\t\t// save the original cursor position and topline\n\t\twp->w_save_cursor.w_cursor_save = wp->w_cursor;\n\t\twp->w_save_cursor.w_topline_save = wp->w_topline;\n\t }\n\n\t if (wp->w_cursor.lnum > curbuf->b_ml.ml_line_count)\n\t\twp->w_cursor.lnum = curbuf->b_ml.ml_line_count;\n\t if (wp->w_topline > curbuf->b_ml.ml_line_count)\n\t\twp->w_topline = curbuf->b_ml.ml_line_count;\n\n\t // save the (corrected) cursor position and topline\n\t wp->w_save_cursor.w_cursor_corr = wp->w_cursor;\n\t wp->w_save_cursor.w_topline_corr = wp->w_topline;\n\t}\n}", "label": 1, "label_name": "safe"} -{"code": "\tthis.getstate = function(sel) {\n\t\tvar sel = this.files(sel),\n\t\t\tcnt = sel.length;\n\t\t\t\n\t\treturn this.callback && cnt && filter(sel).length == cnt ? 0 : -1;\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": "K&&D(Editor.svgBrokenImage.src)});else{var N=new Image;this.crossOriginImages&&(N.crossOrigin=\"anonymous\");N.onload=function(){window.clearTimeout(T);if(K)try{var Q=document.createElement(\"canvas\"),R=Q.getContext(\"2d\");Q.height=N.height;Q.width=N.width;R.drawImage(N,0,0);D(Q.toDataURL())}catch(Y){D(Editor.svgBrokenImage.src)}};N.onerror=function(){window.clearTimeout(T);K&&D(Editor.svgBrokenImage.src)};N.src=u}}catch(Q){D(Editor.svgBrokenImage.src)}};Editor.prototype.convertImages=function(u,D,K,", "label": 1, "label_name": "safe"} -{"code": " protected function connectionWarningsHandler($errno, $errstr)\n {\n if ($errno & E_WARNING) {\n array_unshift($this->connectionWarnings, $errstr);\n }\n return true;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " Returns the block size of the algorithm */\nPHP_FUNCTION(mcrypt_module_get_algo_block_size)\n{\n\tMCRYPT_GET_MODE_DIR_ARGS(algorithms_dir)\n\t\n\tRETURN_LONG(mcrypt_module_get_algo_block_size(module, dir));", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic function validateEmail($email)\n\t{\n\t\treturn filter_var(trim($email), FILTER_VALIDATE_EMAIL);\n\t}", "label": 1, "label_name": "safe"} -{"code": " def secure_reaction_users!(reaction_users)\n if !guardian.can_see_private_messages?(current_user.id) || !guardian.user\n reaction_users = reaction_users.where(\"topics.archetype <> :private_message\", private_message: archetype::private_message)\n else\n unless guardian.is_admin?\n sql = <<~SQL\n topics.archetype <> :private_message OR\n EXISTS (\n SELECT 1 FROM topic_allowed_users tu WHERE tu.topic_id = topics.id AND tu.user_id = :current_user_id\n ) OR\n EXISTS (\n SELECT 1 FROM topic_allowed_groups tg WHERE tg.topic_id = topics.id AND tg.group_id IN (\n SELECT group_id FROM group_users gu WHERE gu.user_id = :current_user_id\n )\n )\n SQL\n\n reaction_users = reaction_users.where(sql, private_message: Archetype::private_message, current_user_id: guardian.user.id)\n end\n end\n\n unless guardian.is_admin?\n allowed = guardian.secure_category_ids\n if allowed.present?\n reaction_users = reaction_users.where(\"(categories.read_restricted IS NULL OR\n NOT categories.read_restricted OR\n (categories.read_restricted and categories.id in (:categories)) )\", categories: guardian.secure_category_ids)\n else\n reaction_users = reaction_users.where(\"(categories.read_restricted IS NULL OR NOT categories.read_restricted)\")\n end\n end\n\n reaction_users\n end", "label": 1, "label_name": "safe"} -{"code": " it 'returns the right response' do\n get \"/session/email-login/adasdad\"\n\n expect(response.status).to eq(200)\n\n expect(CGI.unescapeHTML(response.body)).to match(\n I18n.t('email_login.invalid_token')\n )\n end", "label": 0, "label_name": "vulnerable"} -{"code": " public function destroy(Request $request, TransactionCurrency $currency)\n {\n /** @var User $user */\n $user = auth()->user();\n if (!$this->userRepository->hasRole($user, 'owner')) {\n\n $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))]));\n Log::channel('audit')->info(sprintf('Tried to delete currency %s but is not site owner.', $currency->code));\n\n return redirect(route('currencies.index'));\n\n }\n\n if ($this->repository->currencyInUse($currency)) {\n $request->session()->flash('error', (string)trans('firefly.cannot_delete_currency', ['name' => e($currency->name)]));\n Log::channel('audit')->info(sprintf('Tried to delete currency %s but is in use.', $currency->code));\n\n return redirect(route('currencies.index'));\n }\n\n if ($this->repository->isFallbackCurrency($currency)) {\n $request->session()->flash('error', (string)trans('firefly.cannot_delete_fallback_currency', ['name' => e($currency->name)]));\n Log::channel('audit')->info(sprintf('Tried to delete currency %s but is FALLBACK.', $currency->code));\n\n return redirect(route('currencies.index'));\n }\n\n Log::channel('audit')->info(sprintf('Deleted currency %s.', $currency->code));\n $this->repository->destroy($currency);\n\n $request->session()->flash('success', (string)trans('firefly.deleted_currency', ['name' => $currency->name]));\n\n return redirect($this->getPreviousUri('currencies.delete.uri'));\n }", "label": 1, "label_name": "safe"} -{"code": "this.graph.getTooltip(c,d,e,f);this.show(k,e,f);this.state=c;this.node=d;this.stateSource=g}}),this.delay)}};mxTooltipHandler.prototype.hide=function(){this.resetTimer();this.hideTooltip()};mxTooltipHandler.prototype.hideTooltip=function(){null!=this.div&&(this.div.style.visibility=\"hidden\",this.div.innerHTML=\"\")};", "label": 0, "label_name": "vulnerable"} -{"code": "elFinder.prototype.commands.forward = function() {\n\tthis.alwaysEnabled = true;\n\tthis.updateOnSelect = true;\n\tthis.shortcuts = [{\n\t\tpattern : 'ctrl+right'\n\t}];\n\t\n\tthis.getstate = function() {\n\t\treturn this.fm.history.canForward() ? 0 : -1;\n\t}\n\t\n\tthis.exec = function() {\n\t\treturn this.fm.history.forward();\n\t}\n\t\n}", "label": 0, "label_name": "vulnerable"} -{"code": "bool createBLSShare(const string &blsKeyName, const char *s_shares, const char *encryptedKeyHex) {\n\n CHECK_STATE(s_shares);\n CHECK_STATE(encryptedKeyHex);\n\n vector errMsg(BUF_LEN,0);\n int errStatus = 0;\n\n uint64_t decKeyLen;\n SAFE_UINT8_BUF(encr_bls_key,BUF_LEN);\n SAFE_UINT8_BUF(encr_key,BUF_LEN);\n if (!hex2carray(encryptedKeyHex, &decKeyLen, encr_key, BUF_LEN)) {\n throw SGXException(INVALID_HEX, \"Invalid encryptedKeyHex\");\n }\n\n uint64_t enc_bls_len = 0;\n\n sgx_status_t status = trustedCreateBlsKeyAES(eid, &errStatus, errMsg.data(), s_shares, encr_key, decKeyLen, encr_bls_key,\n &enc_bls_len);\n\n HANDLE_TRUSTED_FUNCTION_ERROR(status, errStatus, errMsg.data());\n\n SAFE_CHAR_BUF(hexBLSKey,2 * BUF_LEN)\n\n carray2Hex(encr_bls_key, enc_bls_len, hexBLSKey, 2 * BUF_LEN);\n\n SGXWalletServer::writeDataToDB(blsKeyName, hexBLSKey);\n\n return true;\n\n}", "label": 1, "label_name": "safe"} -{"code": "void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt)\n{\n\tstatic atomic_t ipv6_fragmentation_id;\n\tint old, new;\n\n\tif (rt) {\n\t\tstruct inet_peer *peer;\n\n\t\tif (!rt->rt6i_peer)\n\t\t\trt6_bind_peer(rt, 1);\n\t\tpeer = rt->rt6i_peer;\n\t\tif (peer) {\n\t\t\tfhdr->identification = htonl(inet_getid(peer, 0));\n\t\t\treturn;\n\t\t}\n\t}\n\tdo {\n\t\told = atomic_read(&ipv6_fragmentation_id);\n\t\tnew = old + 1;\n\t\tif (!new)\n\t\t\tnew = 1;\n\t} while (atomic_cmpxchg(&ipv6_fragmentation_id, old, new) != old);\n\tfhdr->identification = htonl(new);\n}", "label": 1, "label_name": "safe"} -{"code": "ber_parse_header(STREAM s, int tagval, uint32 *length)\n{\n\tint tag, len;\n\n\tif (tagval > 0xff)\n\t{\n\t\tin_uint16_be(s, tag);\n\t}\n\telse\n\t{\n\t\tin_uint8(s, tag);\n\t}\n\n\tif (tag != tagval)\n\t{\n\t\tlogger(Core, Error, \"ber_parse_header(), expected tag %d, got %d\", tagval, tag);\n\t\treturn False;\n\t}\n\n\tin_uint8(s, len);\n\n\tif (len & 0x80)\n\t{\n\t\tlen &= ~0x80;\n\t\t*length = 0;\n\t\twhile (len--)\n\t\t\tnext_be(s, *length);\n\t}\n\telse\n\t\t*length = len;\n\n\treturn s_check(s);\n}", "label": 1, "label_name": "safe"} -{"code": " function build_daterange_sql($timestamp, $endtimestamp=null, $field='date', $multiday=false) {\n if (empty($endtimestamp)) {\n $date_sql = \"((\".$field.\" >= \" . expDateTime::startOfDayTimestamp($timestamp) . \" AND \".$field.\" <= \" . expDateTime::endOfDayTimestamp($timestamp) . \")\";\n } else {\n $date_sql = \"((\".$field.\" >= \" . expDateTime::startOfDayTimestamp($timestamp) . \" AND \".$field.\" <= \" . expDateTime::endOfDayTimestamp($endtimestamp) . \")\";\n }\n if ($multiday)\n $date_sql .= \" OR (\" . expDateTime::startOfDayTimestamp($timestamp) . \" BETWEEN \".$field.\" AND dateFinished)\";\n $date_sql .= \")\";\n return $date_sql;\n }", "label": 1, "label_name": "safe"} -{"code": " private void Setup()\n {\n \n\n\n Console.WriteLine(\"Creating settings\");\n \n var settings = Config.Load();\n\n \n \n Console.WriteLine(\"Configuring up server\");\n Tools.ConfigureServer();\n \n \n \n Console.WriteLine(Assembly.GetExecutingAssembly().GetName().Version);\n var useTerminal = settings.Terminal.AllowTerminal;\n var useWebServer = settings.WebServer.ToggleWebServer;\n var useWebCams = settings.Webcams.UseWebcams;\n if (useWebCams)\n {\n Console.WriteLine(\"Loading Webcams\");\n WebCamManager.LoadCameras();\n }\n if (useWebServer)\n {\n Console.WriteLine(\"Setting up HTTP Server\");\n HttpServer.Setup();\n }\n systemService = new SystemService();\n Console.WriteLine(\"Creating system service\");\n systemService.Start();\n UlteriusApiServer.RunningAsService = Tools.RunningAsService();\n Console.Write($\"Service: {UlteriusApiServer.RunningAsService}\");\n UlteriusApiServer.Start();\n \n if (useTerminal)\n {\n Console.WriteLine(\"Starting Terminal API\");\n TerminalManagerServer.Start();\n }\n try\n {\n var useUpnp = settings.Network.UpnpEnabled;\n if (useUpnp)\n {\n Console.WriteLine(\"Trying to forward ports\");\n Tools.ForwardPorts();\n }\n }\n catch (Exception)\n {\n Console.WriteLine(\"Failed to forward ports\");\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": "function action_wireless(iface)\n\tluci.http.prepare_content(\"application/json\")\n\n\tlocal bwc = io.popen(\"luci-bwc -r '%s' 2>/dev/null\" % iface:gsub(\"'\", \"\"))\n\tif bwc then\n\t\tluci.http.write(\"[\")\n\n\t\twhile true do\n\t\t\tlocal ln = bwc:read(\"*l\")\n\t\t\tif not ln then break end\n\t\t\tluci.http.write(ln)\n\t\tend\n\n\t\tluci.http.write(\"]\")\n\t\tbwc:close()\n\tend\nend", "label": 1, "label_name": "safe"} -{"code": "func evalAndCollect(ev *eval.Evaler, code string) (\n\toutBytes []byte, outValues []interface{}, errBytes []byte, err error) {", "label": 0, "label_name": "vulnerable"} -{"code": "func NewConcatKDF(hash crypto.Hash, z, algID, ptyUInfo, ptyVInfo, supPubInfo, supPrivInfo []byte) io.Reader {\n\tbuffer := make([]byte, uint64(len(algID))+uint64(len(ptyUInfo))+uint64(len(ptyVInfo))+uint64(len(supPubInfo))+uint64(len(supPrivInfo)))\n\tn := 0\n\tn += copy(buffer, algID)\n\tn += copy(buffer[n:], ptyUInfo)\n\tn += copy(buffer[n:], ptyVInfo)\n\tn += copy(buffer[n:], supPubInfo)\n\tcopy(buffer[n:], supPrivInfo)\n\n\thasher := hash.New()\n\n\treturn &concatKDF{\n\t\tz: z,\n\t\tinfo: buffer,\n\t\thasher: hasher,\n\t\tcache: []byte{},\n\t\ti: 1,\n\t}\n}", "label": 1, "label_name": "safe"} -{"code": " function query($query)\n {\n $this->log('Auth_Container_MDB::query() called.', AUTH_LOG_DEBUG);\n $err = $this->_prepare();\n if ($err !== true) {\n return $err;\n }\n return $this->db->query($query);\n }", "label": 0, "label_name": "vulnerable"} -{"code": " it 'should return a second factor prompt' do\n get \"/session/email-login/#{email_token.token}\"\n\n expect(response.status).to eq(200)\n\n response_body = CGI.unescapeHTML(response.body)\n\n expect(response_body).to include(I18n.t(\n \"login.second_factor_title\"\n ))\n\n expect(response_body).to_not include(I18n.t(\n \"login.invalid_second_factor_code\"\n ))\n end", "label": 0, "label_name": "vulnerable"} -{"code": " public function testOverNesting()\n {\n $parser = new JBBCode\\Parser();\n $parser->addCodeDefinitionSet(new JBBCode\\DefaultCodeDefinitionSet());\n $parser->addBBCode('quote', '
{param}
', false, true, 2);\n $bbcode = '[quote][quote][quote]wut[/quote] huh?[/quote] i don\\'t know[/quote]';\n $parser->parse($bbcode);\n $expectedBbcode = '[quote][quote] huh?[/quote] i don\\'t know[/quote]';\n $expectedHtml = '
huh?
i don\\'t know
';\n $this->assertEquals($expectedBbcode, $parser->getAsBBCode());\n $this->assertEquals($expectedHtml, $parser->getAsHtml());\n }", "label": 1, "label_name": "safe"} -{"code": "void * CAPSTONE_API cs_winkernel_malloc(size_t size)\n{\n\t// Disallow zero length allocation because they waste pool header space and,\n\t// in many cases, indicate a potential validation issue in the calling code.\n\tNT_ASSERT(size);\n\n\t// FP; a use of NonPagedPool is required for Windows 7 support\n#pragma prefast(suppress : 30030)\t\t// Allocating executable POOL_TYPE memory\n\tCS_WINKERNEL_MEMBLOCK *block = (CS_WINKERNEL_MEMBLOCK *)ExAllocatePoolWithTag(\n\t\t\tNonPagedPool, size + sizeof(CS_WINKERNEL_MEMBLOCK), CS_WINKERNEL_POOL_TAG);\n\tif (!block) {\n\t\treturn NULL;\n\t}\n\tblock->size = size;\n\n\treturn block->data;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "mcs_parse_domain_params(STREAM s)\n{\n\tuint32 length;\n\tstruct stream packet = *s;\n\n\tber_parse_header(s, MCS_TAG_DOMAIN_PARAMS, &length);\n\n\tif (!s_check_rem(s, length))\n\t{\n\t\trdp_protocol_error(\"mcs_parse_domain_params(), consume domain params from stream would overrun\", &packet);\n\t}\n\n\tin_uint8s(s, length);\n\n\treturn s_check(s);\n}", "label": 1, "label_name": "safe"} -{"code": " message: new MockBuilder(\n {\n from: 'test@valid.sender',\n to: 'test+timeout@valid.recipient'\n },\n message\n )\n },\n function (err) {\n expect(err).to.exist;\n pool.close();\n done();\n }\n );\n });", "label": 1, "label_name": "safe"} -{"code": "Editor.commonVertexProperties=[{name:\"colspan\",dispName:\"Colspan\",type:\"int\",min:1,defVal:1,isVisible:function(u,E){E=E.editorUi.editor.graph;return 1==u.vertices.length&&0==u.edges.length&&E.isTableCell(u.vertices[0])}},{name:\"rowspan\",dispName:\"Rowspan\",type:\"int\",min:1,defVal:1,isVisible:function(u,E){E=E.editorUi.editor.graph;return 1==u.vertices.length&&0==u.edges.length&&E.isTableCell(u.vertices[0])}},{type:\"separator\"},{name:\"resizeLastRow\",dispName:\"Resize Last Row\",type:\"bool\",getDefaultValue:function(u,\nE){u=E.editorUi.editor.graph.getCellStyle(1==u.vertices.length&&0==u.edges.length?u.vertices[0]:null);return\"1\"==mxUtils.getValue(u,\"resizeLastRow\",\"0\")},isVisible:function(u,E){E=E.editorUi.editor.graph;return 1==u.vertices.length&&0==u.edges.length&&E.isTable(u.vertices[0])}},{name:\"resizeLast\",dispName:\"Resize Last Column\",type:\"bool\",getDefaultValue:function(u,E){u=E.editorUi.editor.graph.getCellStyle(1==u.vertices.length&&0==u.edges.length?u.vertices[0]:null);return\"1\"==mxUtils.getValue(u,\"resizeLast\",", "label": 0, "label_name": "vulnerable"} -{"code": " public function api() {\n if (empty($this->params['apikey'])) {\n $_REQUEST['apikey'] = true; // set this to force an ajax reply\n $ar = new expAjaxReply(550, 'Permission Denied', 'You need an API key in order to access Exponent as a Service', null);\n $ar->send(); //FIXME this doesn't seem to work correctly in this scenario\n } else {\n $key = expUnserialize(base64_decode(urldecode($this->params['apikey'])));\n preg_match('/[^a-zA-Z_][^a-zA-Z0-9_]*/', $key, $matches);\n $key = $matches[0];\n $cfg = new expConfig($key);\n $this->config = $cfg->config;\n if(empty($cfg->id)) {\n $ar = new expAjaxReply(550, 'Permission Denied', 'Incorrect API key or Exponent as a Service module configuration missing', null);\n $ar->send();\n } else {\n if (!empty($this->params['get'])) {\n $this->handleRequest();\n } else {\n $ar = new expAjaxReply(200, 'ok', 'Your API key is working, no data requested', null);\n $ar->send();\n }\n }\n }\n }", "label": 1, "label_name": "safe"} -{"code": " size_t operator()(const ArrayOrObject data) const {\n return data.toOpaque();\n }", "label": 1, "label_name": "safe"} -{"code": "PyMem_RawRealloc(void *ptr, size_t new_size)\n{\n /* see PyMem_RawMalloc() */\n if (new_size > (size_t)PY_SSIZE_T_MAX)\n return NULL;\n return _PyMem_Raw.realloc(_PyMem_Raw.ctx, ptr, new_size);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "\twp.updates.updatePluginSuccess = function( response ) {\n\t\tvar $pluginRow, $updateMessage, newText;\n\n\t\tif ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {\n\t\t\t$pluginRow = $( 'tr[data-plugin=\"' + response.plugin + '\"]' )\n\t\t\t\t.removeClass( 'update' )\n\t\t\t\t.addClass( 'updated' );\n\t\t\t$updateMessage = $pluginRow.find( '.update-message' )\n\t\t\t\t.removeClass( 'updating-message notice-warning' )\n\t\t\t\t.addClass( 'updated-message notice-success' ).find( 'p' );\n\n\t\t\t// Update the version number in the row.\n\t\t\tnewText = $pluginRow.find( '.plugin-version-author-uri' ).html().replace( response.oldVersion, response.newVersion );\n\t\t\t$pluginRow.find( '.plugin-version-author-uri' ).html( newText );\n\t\t} else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {\n\t\t\t$updateMessage = $( '.plugin-card-' + response.slug ).find( '.update-now' )\n\t\t\t\t.removeClass( 'updating-message' )\n\t\t\t\t.addClass( 'button-disabled updated-message' );\n\t\t}\n\n\t\t$updateMessage\n\t\t\t.attr( 'aria-label', wp.updates.l10n.updatedLabel.replace( '%s', response.pluginName ) )\n\t\t\t.text( wp.updates.l10n.updated );\n\n\t\twp.a11y.speak( wp.updates.l10n.updatedMsg, 'polite' );\n\n\t\twp.updates.decrementCount( 'plugin' );\n\n\t\t$document.trigger( 'wp-plugin-update-success', response );\n\t};", "label": 1, "label_name": "safe"} -{"code": "$.fn.elfindermkdirbutton = function(cmd) {\n\treturn this.each(function() {\n\t\tvar button = $(this).elfinderbutton(cmd);\n\n\t\tcmd.change(function() {\n\t\t\tbutton.attr('title', cmd.value);\n\t\t});\n\t});\n};", "label": 1, "label_name": "safe"} -{"code": " public static function getHelpVersion($version_id) {\n global $db;\n\n return $db->selectValue('help_version', 'version', 'id=\"'.$version_id.'\"');\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public void existingDocumentFromUITemplateProviderSpecifiedNonTerminalOverridenFromUIToTerminal() throws Exception\n {\n // current document = xwiki:Main.WebHome\n DocumentReference documentReference = new DocumentReference(\"xwiki\", Arrays.asList(\"Main\"), \"WebHome\");\n XWikiDocument document = mock(XWikiDocument.class);\n when(document.getDocumentReference()).thenReturn(documentReference);\n when(document.isNew()).thenReturn(false);\n when(document.getLocalReferenceMaxLength()).thenReturn(255);\n context.setDoc(document);\n\n // Submit from the UI spaceReference=X&name=Y&templateProvider=XWiki.MyTemplateProvider\n String templateProviderFullName = \"XWiki.MyTemplateProvider\";\n String spaceReferenceString = \"X\";\n when(mockRequest.getParameter(\"spaceReference\")).thenReturn(spaceReferenceString);\n when(mockRequest.getParameter(\"name\")).thenReturn(\"Y\");\n when(mockRequest.getParameter(\"templateprovider\")).thenReturn(templateProviderFullName);\n when(mockRequest.getParameter(\"tocreate\")).thenReturn(\"terminal\");\n\n // Mock 1 existing template provider that creates terminal documents.\n mockExistingTemplateProviders(templateProviderFullName,\n new DocumentReference(\"xwiki\", Arrays.asList(\"XWiki\"), \"MyTemplateProvider\"), Collections.EMPTY_LIST,\n false);\n\n // Run the action\n String result = action.render(context);\n\n // The tests are below this line!\n\n // Verify null is returned (this means the response has been returned)\n assertNull(result);\n\n // Note: We are creating the document X.Y as terminal, even if the template provider says otherwise.\n // Also using a template, as specified in the template provider.\n verify(mockURLFactory).createURL(\"X\", \"Y\", \"edit\", \"template=XWiki.MyTemplate&parent=Main.WebHome&title=Y\",\n null, \"xwiki\", context);\n }", "label": 0, "label_name": "vulnerable"} -{"code": "static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp)\n{\n\tint *fdp = (int*)CMSG_DATA(cmsg);\n\tstruct scm_fp_list *fpl = *fplp;\n\tstruct file **fpp;\n\tint i, num;\n\n\tnum = (cmsg->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr)))/sizeof(int);\n\n\tif (num <= 0)\n\t\treturn 0;\n\n\tif (num > SCM_MAX_FD)\n\t\treturn -EINVAL;\n\n\tif (!fpl)\n\t{\n\t\tfpl = kmalloc(sizeof(struct scm_fp_list), GFP_KERNEL);\n\t\tif (!fpl)\n\t\t\treturn -ENOMEM;\n\t\t*fplp = fpl;\n\t\tfpl->count = 0;\n\t\tfpl->max = SCM_MAX_FD;\n\t\tfpl->user = NULL;\n\t}\n\tfpp = &fpl->fp[fpl->count];\n\n\tif (fpl->count + num > fpl->max)\n\t\treturn -EINVAL;\n\n\t/*\n\t *\tVerify the descriptors and increment the usage count.\n\t */\n\n\tfor (i=0; i< num; i++)\n\t{\n\t\tint fd = fdp[i];\n\t\tstruct file *file;\n\n\t\tif (fd < 0 || !(file = fget_raw(fd)))\n\t\t\treturn -EBADF;\n\t\t*fpp++ = file;\n\t\tfpl->count++;\n\t}\n\n\tif (!fpl->user)\n\t\tfpl->user = get_uid(current_user());\n\n\treturn num;\n}", "label": 1, "label_name": "safe"} -{"code": " public function testCompilePathIsProperlyCreated()\n {\n $compiler = new BladeCompiler($this->getFiles(), __DIR__);\n $this->assertEquals(__DIR__.'/'.sha1('foo').'.php', $compiler->getCompiledPath('foo'));\n }", "label": 0, "label_name": "vulnerable"} -{"code": " it \"should be able to count arrays\" do\n expect(scope.function_count([[\"1\",\"2\",\"3\"]])).to(eq(3))\n end", "label": 0, "label_name": "vulnerable"} -{"code": " def prepare_context(self, request, context, *args, **kwargs):\n \"\"\" Hook for adding additional data to the context dict \"\"\"\n pass", "label": 0, "label_name": "vulnerable"} -{"code": " public function store($zdb)\n {\n try {\n $values = array(\n self::PK => $this->id,\n 'model_fields' => serialize($this->fields)\n );\n\n if (!isset($this->id) || $this->id == '') {\n //we're inserting a new model\n unset($values[self::PK]);\n $this->creation_date = date(\"Y-m-d H:i:s\");\n $values['model_creation_date'] = $this->creation_date;\n\n $insert = $zdb->insert(self::TABLE);\n $insert->values($values);\n $results = $zdb->execute($insert);\n\n if ($results->count() > 0) {\n return true;\n } else {\n throw new \\Exception(\n 'An error occurred inserting new import model!'\n );\n }\n } else {\n //we're editing an existing model\n $update = $zdb->update(self::TABLE);\n $update->set($values);\n $update->where(self::PK . '=' . $this->id);\n $zdb->execute($update);\n return true;\n }\n } catch (Throwable $e) {\n Analog::log(\n 'Something went wrong storing import model :\\'( | ' .\n $e->getMessage() . \"\\n\" . $e->getTraceAsString(),\n Analog::ERROR\n );\n throw $e;\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": "static int xfrm_dump_policy(struct sk_buff *skb, struct netlink_callback *cb)\n{\n\tstruct net *net = sock_net(skb->sk);\n\tstruct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1];\n\tstruct xfrm_dump_info info;\n\n\tBUILD_BUG_ON(sizeof(struct xfrm_policy_walk) >\n\t\t sizeof(cb->args) - sizeof(cb->args[0]));\n\n\tinfo.in_skb = cb->skb;\n\tinfo.out_skb = skb;\n\tinfo.nlmsg_seq = cb->nlh->nlmsg_seq;\n\tinfo.nlmsg_flags = NLM_F_MULTI;\n\n\tif (!cb->args[0]) {\n\t\tcb->args[0] = 1;\n\t\txfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY);\n\t}\n\n\t(void) xfrm_policy_walk(net, walk, dump_one_policy, &info);\n\n\treturn skb->len;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " function oneTimeListener(value, old, scope) {\n lastValue = value;\n if (isFunction(listener)) {\n listener(value, old, scope);\n }\n if (isDefined(value)) {\n scope.$$postDigest(function() {\n if (isDefined(lastValue)) {\n unwatch();\n }\n });\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": " self::rpc($p);\r\n //echo \"'$p'
\";\r\n }\r\n }\r\n }\r", "label": 0, "label_name": "vulnerable"} -{"code": "spnego_gss_inquire_context(\n\t\t\tOM_uint32\t*minor_status,\n\t\t\tconst gss_ctx_id_t context_handle,\n\t\t\tgss_name_t\t*src_name,\n\t\t\tgss_name_t\t*targ_name,\n\t\t\tOM_uint32\t*lifetime_rec,\n\t\t\tgss_OID\t\t*mech_type,\n\t\t\tOM_uint32\t*ctx_flags,\n\t\t\tint\t\t*locally_initiated,\n\t\t\tint\t\t*opened)\n{\n\tOM_uint32 ret = GSS_S_COMPLETE;\n\n\tret = gss_inquire_context(minor_status,\n\t\t\t\tcontext_handle,\n\t\t\t\tsrc_name,\n\t\t\t\ttarg_name,\n\t\t\t\tlifetime_rec,\n\t\t\t\tmech_type,\n\t\t\t\tctx_flags,\n\t\t\t\tlocally_initiated,\n\t\t\t\topened);\n\n\treturn (ret);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "X){null!=X.shortcut&&900>n&&!mxClient.IS_IOS?O.firstChild.nextSibling.setAttribute(\"title\",X.shortcut):m.apply(this,arguments)};var q=App.prototype.updateUserElement;App.prototype.updateUserElement=function(){q.apply(this,arguments);if(null!=this.userElement){var O=this.userElement;O.style.cssText=\"position:relative;margin-right:4px;cursor:pointer;display:\"+O.style.display;O.className=\"geToolbarButton\";O.innerHTML=\"\";O.style.backgroundImage=\"url(\"+Editor.userImage+\")\";O.style.backgroundPosition=\"center center\";\nO.style.backgroundRepeat=\"no-repeat\";O.style.backgroundSize=\"24px 24px\";O.style.height=\"24px\";O.style.width=\"24px\";O.style.cssFloat=\"right\";O.setAttribute(\"title\",mxResources.get(\"changeUser\"));if(\"none\"!=O.style.display){O.style.display=\"inline-block\";var X=this.getCurrentFile();if(null!=X&&X.isRealtimeEnabled()&&X.isRealtimeSupported()){var ea=document.createElement(\"img\");ea.setAttribute(\"border\",\"0\");ea.style.position=\"absolute\";ea.style.left=\"18px\";ea.style.top=\"2px\";ea.style.width=\"12px\";ea.style.height=\n\"12px\";var ka=X.getRealtimeError();X=X.getRealtimeState();var ja=mxResources.get(\"realtimeCollaboration\");1==X?(ea.src=Editor.syncImage,ja+=\" (\"+mxResources.get(\"online\")+\")\"):(ea.src=Editor.syncProblemImage,ja=null!=ka&&null!=ka.message?ja+(\" (\"+ka.message+\")\"):ja+(\" (\"+mxResources.get(\"disconnected\")+\")\"));ea.setAttribute(\"title\",ja);O.style.paddingRight=\"4px\";O.appendChild(ea)}}}};var y=App.prototype.updateButtonContainer;App.prototype.updateButtonContainer=function(){y.apply(this,arguments);if(null!=", "label": 1, "label_name": "safe"} -{"code": " public function __construct()\n {\n parent::__construct();\n if ($GLOBALS['HTMLPurifierTest']['PH5P']) {\n require_once 'HTMLPurifier/Lexer/PH5P.php';\n }\n }", "label": 1, "label_name": "safe"} -{"code": " function __construct () {\r\n\r\n }\r", "label": 0, "label_name": "vulnerable"} -{"code": "function _showSelectDialog(title, label, options, button, callbackFcn, callbackArg, defaultValue) {\n var dialog = dialogs[title+label];\n if (dialog) {\n $(\"bgDialogDiv\").show();\n }\n else {\n var fields = createElement(\"p\", null, []);\n\tfields.update(label);\n var select = createElement(\"select\"); //, null, null, { cname: name } );\n\tfields.appendChild(select);\n var values = $H(options).keys();\n for (var i = 0; i < values.length; i++) {\n var option = createElement(\"option\", null, null,\n { value: values[i] }, null, select);\n option.update(options[values[i]]);\n }\n fields.appendChild(createElement(\"br\"));\n\n fields.appendChild(createButton(null,\n button,\n callbackFcn.bind(select, callbackArg)));\n\tfields.appendChild(createButton(null,\n _(\"Cancel\"),\n disposeDialog));\n dialog = createDialog(null,\n title,\n null,\n fields,\n \"none\");\n document.body.appendChild(dialog);\n dialogs[title+label] = dialog;\n }\n if (defaultValue)\n\tdefaultOption = dialog.down('option[value=\"'+defaultValue+'\"]').selected = true;\n if (Prototype.Browser.IE)\n jQuery('#bgDialogDiv').css('opacity', 0.4);\n jQuery(dialog).fadeIn('fast');\n}", "label": 1, "label_name": "safe"} -{"code": " return !isset($thisstaff) || $f->isRequiredForStaff();\n };\n if (!$form->isValid($filter))\n $valid = false;\n\n //Make sure the email is not in-use\n if (($field=$form->getField('email'))\n && $field->getClean()\n && User::lookup(array('emails__address'=>$field->getClean()))) {\n $field->addError(__('Email is assigned to another user'));\n $valid = false;\n }\n\n return $valid ? self::fromVars($form->getClean(), $create) : null;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "function buildURL (source, reqBase) {\n const dest = new URL(source, reqBase)\n\n // if base is specified, source url should not override it\n if (reqBase && !reqBase.startsWith(dest.origin)) {\n throw new Error('source must be a relative path string')\n }\n\n return dest\n}", "label": 0, "label_name": "vulnerable"} -{"code": "\tprivate function _ordercollation( $option ) {\n\t\t$option = mb_strtolower( $option );\n\n\t\t$results = $this->DB->query( 'SHOW CHARACTER SET' );\n\t\tif ( !$results ) {\n\t\t\treturn false;\n\t\t}\n\n\t\twhile ( $row = $results->fetchRow() ) {\n\t\t\tif ( $option == $row['Default collation'] ) {\n\t\t\t\t$this->setCollation( $option );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}", "label": 1, "label_name": "safe"} -{"code": " labels: templateInstance.topTasks.get().map((task) => $('').text(task._id).html()),\n datasets: [{\n values: templateInstance.topTasks.get().map((task) => task.count),\n }],\n },\n tooltipOptions: {\n },\n })\n })\n })\n }", "label": 1, "label_name": "safe"} -{"code": " def self.get_for(user, mail_account_id, xtype)\n\n return nil if user.nil? or mail_account_id.blank?\n\n if user.kind_of?(User)\n user_id = user.id\n else\n user_id = user.to_s\n end\n\n SqlHelper.validate_token([user_id, mail_account_id, xtype])\n\n con = []\n con << \"(user_id=#{user_id})\"\n con << \"(mail_account_id=#{mail_account_id})\"\n con << \"(xtype='#{xtype}')\"\n\n return MailFolder.where(con.join(' and ')).first\n end", "label": 0, "label_name": "vulnerable"} -{"code": "function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {\n\tfor ( var i = 0, l = checkSet.length; i < l; i++ ) {\n\t\tvar elem = checkSet[i];\n\t\tif ( elem ) {\n\t\t\telem = elem[dir];\n\t\t\tvar match = false;\n\n\t\t\twhile ( elem && elem.nodeType ) {\n\t\t\t\tvar done = elem[doneName];\n\t\t\t\tif ( done ) {\n\t\t\t\t\tmatch = checkSet[ done ];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif ( elem.nodeType === 1 && !isXML )\n\t\t\t\t\telem[doneName] = i;\n\n\t\t\t\tif ( elem.nodeName === cur ) {\n\t\t\t\t\tmatch = elem;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\telem = elem[dir];\n\t\t\t}\n\n\t\t\tcheckSet[i] = match;\n\t\t}\n\t}\n}", "label": 0, "label_name": "vulnerable"} -{"code": "void kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr)\n{\n\tvcpu->arch.apic->vapic_addr = vapic_addr;\n\tif (vapic_addr)\n\t\t__set_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention);\n\telse\n\t\t__clear_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention);\n}", "label": 0, "label_name": "vulnerable"} -{"code": "R_API RBinJavaAttrInfo *r_bin_java_synthetic_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {\n\tut64 offset = 0;\n\tRBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);\n\tif (!attr) {\n\t\treturn NULL;\n\t}\n\toffset += 6;\n\tattr->type = R_BIN_JAVA_ATTR_TYPE_SYNTHETIC_ATTR;\n\tattr->size = offset;\n\treturn attr;\n}", "label": 0, "label_name": "vulnerable"} -{"code": " function searchName() {\n return gt(\"Calendar Event\");\n }", "label": 1, "label_name": "safe"} -{"code": "\tpublic function delete_version() {\n\t if (empty($this->params['id'])) {\n\t flash('error', gt('The version you are trying to delete could not be found'));\n\t }\n\n\t // get the version\n\t $version = new help_version($this->params['id']);\n\t if (empty($version->id)) {\n\t flash('error', gt('The version you are trying to delete could not be found'));\n\t }\n\n\t // if we have errors than lets get outta here!\n\t if (!expQueue::isQueueEmpty('error')) expHistory::back();\n\n\t // delete the version\n\t $version->delete();\n\n\t expSession::un_set('help-version');\n\n\t flash('message', gt('Deleted version').' '.$version->version.' '.gt('and all documents in that version.'));\n\t expHistory::back();\n\t}", "label": 1, "label_name": "safe"} -{"code": " public function validateChildren($children, $config, $context)\n {\n // Flag for subclasses\n $this->whitespace = false;\n\n // if there are no tokens, delete parent node\n if (empty($children)) {\n return false;\n }\n\n // the new set of children\n $result = array();\n\n // whether or not parsed character data is allowed\n // this controls whether or not we silently drop a tag\n // or generate escaped HTML from it\n $pcdata_allowed = isset($this->elements['#PCDATA']);\n\n // a little sanity check to make sure it's not ALL whitespace\n $all_whitespace = true;\n\n $stack = array_reverse($children);\n while (!empty($stack)) {\n $node = array_pop($stack);\n if (!empty($node->is_whitespace)) {\n $result[] = $node;\n continue;\n }\n $all_whitespace = false; // phew, we're not talking about whitespace\n\n if (!isset($this->elements[$node->name])) {\n // special case text\n // XXX One of these ought to be redundant or something\n if ($pcdata_allowed && $node instanceof HTMLPurifier_Node_Text) {\n $result[] = $node;\n continue;\n }\n // spill the child contents in\n // ToDo: Make configurable\n if ($node instanceof HTMLPurifier_Node_Element) {\n for ($i = count($node->children) - 1; $i >= 0; $i--) {\n $stack[] = $node->children[$i];\n }\n continue;\n }\n continue;\n }\n $result[] = $node;\n }\n if (empty($result)) {\n return false;\n }\n if ($all_whitespace) {\n $this->whitespace = true;\n return false;\n }\n return $result;\n }", "label": 1, "label_name": "safe"} -{"code": " it 'should run successfully' do\n\n pp = \"\n class { 'nginx':\n mail => true,\n }\n nginx::resource::vhost { 'www.puppetlabs.com':\n ensure => present,\n www_root => '/var/www/www.puppetlabs.com',\n }\n nginx::resource::mailhost { 'domain1.example':\n ensure => present,\n auth_http => 'localhost/cgi-bin/auth',\n protocol => 'smtp',\n listen_port => 587,\n ssl_port => 465,\n xclient => 'off',\n }\n \"\n\n puppet_apply(pp) do |r|\n [0,2].should include r.exit_code\n r.refresh\n # Not until deprecated variables fixed.\n #r.stderr.should be_empty\n r.exit_code.should be_zero\n end\n end", "label": 0, "label_name": "vulnerable"} -{"code": "function(){return mxClient.IS_CHROMEAPP||this.useCanvasForExport};Editor.prototype.getMaxCanvasScale=function(p,C,I){var T=mxClient.IS_FF?8192:16384;return Math.min(I,Math.min(T/p,T/C))};Editor.prototype.exportToCanvas=function(p,C,I,T,P,O,R,Y,da,ha,Z,ea,aa,ua,la,Aa,Fa,xa){try{O=null!=O?O:!0;R=null!=R?R:!0;ea=null!=ea?ea:this.graph;aa=null!=aa?aa:0;var Da=da?null:ea.background;Da==mxConstants.NONE&&(Da=null);null==Da&&(Da=T);null==Da&&0==da&&(Da=Aa?this.graph.defaultPageBackgroundColor:\"#ffffff\");", "label": 0, "label_name": "vulnerable"} -{"code": "printlabels(grammar *g, FILE *fp)\n{\n label *l;\n int i;\n\n fprintf(fp, \"static label labels[%d] = {\\n\", g->g_ll.ll_nlabels);\n l = g->g_ll.ll_label;\n for (i = g->g_ll.ll_nlabels; --i >= 0; l++) {\n if (l->lb_str == NULL)\n fprintf(fp, \" {%d, 0},\\n\", l->lb_type);\n else\n fprintf(fp, \" {%d, \\\"%s\\\"},\\n\",\n l->lb_type, l->lb_str);\n }\n fprintf(fp, \"};\\n\");\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function testGetCauseMessage()\n {\n $cause = new Exception('foo bar');\n $e = new PEAR_Exception('I caught an exception', $cause);\n\n $e->getCauseMessage($causes);\n $this->assertEquals('I caught an exception', $causes[0]['message']);\n $this->assertEquals('foo bar', $causes[1]['message']);\n }", "label": 0, "label_name": "vulnerable"} -{"code": " $edges = array_merge($edges, $this->findEdges($id, $argument, $required, $name));\n }", "label": 0, "label_name": "vulnerable"} -{"code": " it 'should contain the default swapfile' do\n shell('/sbin/swapon -s | grep /mnt/swap.1', :acceptable_exit_codes => [0])\n end", "label": 0, "label_name": "vulnerable"} -{"code": "void ConnectionImpl::onHeaderValue(const char* data, size_t length) {\n if (header_parsing_state_ == HeaderParsingState::Done) {\n // Ignore trailers.\n return;\n }\n\n const absl::string_view header_value = absl::string_view(data, length);\n\n if (strict_header_validation_) {\n if (!Http::HeaderUtility::headerIsValid(header_value)) {\n ENVOY_CONN_LOG(debug, \"invalid header value: {}\", connection_, header_value);\n error_code_ = Http::Code::BadRequest;\n sendProtocolError();\n throw CodecProtocolException(\"http/1.1 protocol error: header value contains invalid chars\");\n }\n } else if (header_value.find('\\0') != absl::string_view::npos) {\n // http-parser should filter for this\n // (https://tools.ietf.org/html/rfc7230#section-3.2.6), but it doesn't today. HeaderStrings\n // have an invariant that they must not contain embedded zero characters\n // (NUL, ASCII 0x0).\n throw CodecProtocolException(\"http/1.1 protocol error: header value contains NUL\");\n }\n\n header_parsing_state_ = HeaderParsingState::Value;\n current_header_value_.append(data, length);\n\n const uint32_t total =\n current_header_field_.size() + current_header_value_.size() + current_header_map_->byteSize();\n if (total > (max_request_headers_kb_ * 1024)) {\n error_code_ = Http::Code::RequestHeaderFieldsTooLarge;\n sendProtocolError();\n throw CodecProtocolException(\"headers size exceeds limit\");\n }\n}", "label": 0, "label_name": "vulnerable"} -{"code": "ast2obj_withitem(void* _o)\n{\n withitem_ty o = (withitem_ty)_o;\n PyObject *result = NULL, *value = NULL;\n if (!o) {\n Py_INCREF(Py_None);\n return Py_None;\n }\n\n result = PyType_GenericNew(withitem_type, NULL, NULL);\n if (!result) return NULL;\n value = ast2obj_expr(o->context_expr);\n if (!value) goto failed;\n if (_PyObject_SetAttrId(result, &PyId_context_expr, value) == -1)\n goto failed;\n Py_DECREF(value);\n value = ast2obj_expr(o->optional_vars);\n if (!value) goto failed;\n if (_PyObject_SetAttrId(result, &PyId_optional_vars, value) == -1)\n goto failed;\n Py_DECREF(value);\n return result;\nfailed:\n Py_XDECREF(value);\n Py_XDECREF(result);\n return NULL;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "Na+=\"@import url(\"+La+\");\\n\":Ga+='@font-face {\\nfont-family: \"'+Ea+'\";\\nsrc: url(\"'+La+'\");\\n}\\n'}Ha.appendChild(Aa.createTextNode(Na+Ga));qa.getElementsByTagName(\"defs\")[0].appendChild(Ha)}null!=ja&&(this.shapeBackgroundColor=Da,this.shapeForegroundColor=Ba,this.stylesheet=ja,this.refresh());return qa};var C=Graph.prototype.createSvgImageExport;Graph.prototype.createSvgImageExport=function(){var u=C.apply(this,arguments);if(this.mathEnabled){var D=u.drawText;u.drawText=function(K,T){if(null!=K.text&&\nnull!=K.text.value&&K.text.checkBounds()&&(mxUtils.isNode(K.text.value)||K.text.dialect==mxConstants.DIALECT_STRICTHTML)){var N=K.text.getContentNode();if(null!=N){N=N.cloneNode(!0);if(N.getElementsByTagNameNS)for(var Q=N.getElementsByTagNameNS(\"http://www.w3.org/1998/Math/MathML\",\"math\");0getDefinition('URI', $raw, $optimized);\n }", "label": 1, "label_name": "safe"} -{"code": " def index\n valid_http_methods :get, :post\n\n # for permission check\n if params[:package] and not [\"_repository\", \"_jobhistory\"].include?(params[:package])\n pkg = DbPackage.get_by_project_and_name( params[:project], params[:package], use_source=false )\n else\n prj = DbProject.get_by_name params[:project]\n end\n\n if request.get?\n pass_to_backend \n return\n end\n\n if @http_user.is_admin?\n # check for a local package instance\n DbPackage.get_by_project_and_name( params[:project], params[:package], follow_project_links=false )\n pass_to_backend\n else\n render_error :status => 403, :errorcode => \"execute_cmd_no_permission\",\n :message => \"Upload of binaries is only permitted for administrators\"\n end\n end", "label": 1, "label_name": "safe"} -{"code": " public function __construct(array $params, array $uploads, $useBrackets = true)\n {\n $this->_params = self::_flattenArray('', $params, $useBrackets);\n foreach ($uploads as $fieldName => $f) {\n if (!is_array($f['fp'])) {\n $this->_uploads[] = $f + array('name' => $fieldName);\n } else {\n for ($i = 0; $i < count($f['fp']); $i++) {\n $upload = array(\n 'name' => ($useBrackets? $fieldName . '[' . $i . ']': $fieldName)\n );\n foreach (array('fp', 'filename', 'size', 'type') as $key) {\n $upload[$key] = $f[$key][$i];\n }\n $this->_uploads[] = $upload;\n }\n }\n }\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\"startWidth\",this.defaultArrowWidth)};Ca.prototype.getEndArrowWidth=function(){return this.getEdgeWidth()+mxUtils.getNumber(this.style,\"endWidth\",this.defaultArrowWidth)};Ca.prototype.getEdgeWidth=function(){return mxUtils.getNumber(this.style,\"width\",this.defaultWidth)+Math.max(0,this.strokewidth-1)};mxCellRenderer.registerShape(\"flexArrow\",Ca);mxUtils.extend(Qa,mxActor);Qa.prototype.size=30;Qa.prototype.isRoundable=function(){return!0};Qa.prototype.redrawPath=function(c,l,x,p,v){l=Math.min(v,parseFloat(mxUtils.getValue(this.style,", "label": 1, "label_name": "safe"} -{"code": "\tpublic int decryptWithAd(byte[] ad, byte[] ciphertext,\n\t\t\tint ciphertextOffset, byte[] plaintext, int plaintextOffset,\n\t\t\tint length) throws ShortBufferException, BadPaddingException {\n\t\tint space;\n\t\tif (ciphertextOffset > ciphertext.length)\n\t\t\tspace = 0;\n\t\telse\n\t\t\tspace = ciphertext.length - ciphertextOffset;\n\t\tif (length > space)\n\t\t\tthrow new ShortBufferException();\n\t\tif (plaintextOffset > plaintext.length)\n\t\t\tspace = 0;\n\t\telse\n\t\t\tspace = plaintext.length - plaintextOffset;\n\t\tif (!haskey) {\n\t\t\t// The key is not set yet - return the ciphertext as-is.\n\t\t\tif (length > space)\n\t\t\t\tthrow new ShortBufferException();\n\t\t\tif (plaintext != ciphertext || plaintextOffset != ciphertextOffset)\n\t\t\t\tSystem.arraycopy(ciphertext, ciphertextOffset, plaintext, plaintextOffset, length);\n\t\t\treturn length;\n\t\t}\n\t\tif (length < 16)\n\t\t\tNoise.throwBadTagException();\n\t\tint dataLen = length - 16;\n\t\tif (dataLen > space)\n\t\t\tthrow new ShortBufferException();\n\t\tsetup(ad);\n\t\tghash.update(ciphertext, ciphertextOffset, dataLen);\n\t\tghash.pad(ad != null ? ad.length : 0, dataLen);\n\t\tghash.finish(enciv, 0, 16);\n\t\tint temp = 0;\n\t\tfor (int index = 0; index < 16; ++index)\n\t\t\ttemp |= (hashKey[index] ^ enciv[index] ^ ciphertext[ciphertextOffset + dataLen + index]);\n\t\tif ((temp & 0xFF) != 0)\n\t\t\tNoise.throwBadTagException();\n\t\tencryptCTR(ciphertext, ciphertextOffset, plaintext, plaintextOffset, dataLen);\n\t\treturn dataLen;\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": " public function addChild(Profile $child)\n {\n $this->children[] = $child;\n $child->setParent($this);\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function testTransformToForbiddenElement()\n {\n $this->config->set('HTML.Allowed', 'div');\n $this->assertResult(\n 'Big Warning!',\n 'Big Warning!'\n );\n }", "label": 1, "label_name": "safe"} -{"code": " public function save_change_password() {\n global $user;\n\n $isuser = ($this->params['uid'] == $user->id) ? 1 : 0;\n\n if (!$user->isAdmin() && !$isuser) {\n flash('error', gt('You do not have permissions to change this users password.'));\n expHistory::back();\n }\n\n if (($isuser && empty($this->params['password'])) || (!empty($this->params['password']) && $user->password != user::encryptPassword($this->params['password']))) {\n flash('error', gt('The current password you entered is not correct.'));\n expHistory::returnTo('editable');\n }\n //eDebug($user);\n $u = new user($this->params['uid']);\n\n $ret = $u->setPassword($this->params['new_password1'], $this->params['new_password2']);\n //eDebug($u, true);\n if (is_string($ret)) {\n flash('error', $ret);\n expHistory::returnTo('editable');\n } else {\n $params = array();\n $params['is_admin'] = !empty($u->is_admin);\n $params['is_acting_admin'] = !empty($u->is_acting_admin);\n $u->update($params);\n }\n\n if (!$isuser) {\n flash('message', gt('The password for') . ' ' . $u->username . ' ' . gt('has been changed.'));\n } else {\n $user->password = $u->password;\n flash('message', gt('Your password has been changed.'));\n }\n expHistory::back();\n }", "label": 0, "label_name": "vulnerable"} -{"code": "Runnable.prototype.fullTitle = function() {\n return this.parent.fullTitle() + ' ' + this.title;\n};", "label": 1, "label_name": "safe"} -{"code": "chunk_new_with_alloc_size(size_t alloc)\n{\n chunk_t *ch;\n ch = tor_malloc(alloc);\n ch->next = NULL;\n ch->datalen = 0;\n#ifdef DEBUG_CHUNK_ALLOC\n ch->DBG_alloc = alloc;\n#endif\n ch->memlen = CHUNK_SIZE_WITH_ALLOC(alloc);\n total_bytes_allocated_in_chunks += alloc;\n ch->data = &ch->mem[0];\n CHUNK_SET_SENTINEL(ch, alloc);\n return ch;\n}", "label": 1, "label_name": "safe"} -{"code": " def api_login_allow_multiple_providers(self):\n return self.appbuilder.get_app.config[\"AUTH_API_LOGIN_ALLOW_MULTIPLE_PROVIDERS\"]", "label": 1, "label_name": "safe"} -{"code": "void ecall_find_range_bounds(uint8_t *sort_order, size_t sort_order_length,\n uint32_t num_partitions,\n uint8_t *input_rows, size_t input_rows_length,\n uint8_t **output_rows, size_t *output_rows_length) {\n // Guard against operating on arbitrary enclave memory\n assert(sgx_is_outside_enclave(input_rows, input_rows_length) == 1);\n sgx_lfence();\n\n try {\n find_range_bounds(sort_order, sort_order_length,\n num_partitions,\n input_rows, input_rows_length,\n output_rows, output_rows_length);\n } catch (const std::runtime_error &e) {\n ocall_throw(e.what());\n }\n}", "label": 1, "label_name": "safe"} -{"code": "ProcessTCPHeader(tTcpIpPacketParsingResult _res, PVOID pIpHeader, ULONG len, USHORT ipHeaderSize)\n{\n ULONG tcpipDataAt;\n tTcpIpPacketParsingResult res = _res;\n tcpipDataAt = ipHeaderSize + sizeof(TCPHeader);\n res.TcpUdp = ppresIsTCP;\n\n if (len >= tcpipDataAt)\n {\n TCPHeader *pTcpHeader = (TCPHeader *)RtlOffsetToPointer(pIpHeader, ipHeaderSize);\n res.xxpStatus = ppresXxpKnown;\n res.xxpFull = TRUE;\n tcpipDataAt = ipHeaderSize + TCP_HEADER_LENGTH(pTcpHeader);\n res.XxpIpHeaderSize = tcpipDataAt;\n }\n else\n {\n DPrintf(2, (\"tcp: %d < min headers %d\\n\", len, tcpipDataAt));\n res.xxpFull = FALSE;\n res.xxpStatus = ppresXxpIncomplete;\n }\n return res;\n}", "label": 1, "label_name": "safe"} -{"code": "PHP_FUNCTION(imagesetstyle)\n{\n\tzval *IM, *styles;\n\tgdImagePtr im;\n\tint * stylearr;\n\tint index;\n\tHashPosition pos;\n\n\tif (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, \"ra\", &IM, &styles) == FAILURE) {\n\t\treturn;\n\t}\n\n\tZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, \"Image\", le_gd);\n\n\t/* copy the style values in the stylearr */\n\tstylearr = safe_emalloc(sizeof(int), zend_hash_num_elements(HASH_OF(styles)), 0);\n\n\tzend_hash_internal_pointer_reset_ex(HASH_OF(styles), &pos);\n\n\tfor (index = 0;; zend_hash_move_forward_ex(HASH_OF(styles), &pos))\t{\n\t\tzval ** item;\n\n\t\tif (zend_hash_get_current_data_ex(HASH_OF(styles), (void **) &item, &pos) == FAILURE) {\n\t\t\tbreak;\n\t\t}\n\n\t\tconvert_to_long_ex(item);\n\n\t\tstylearr[index++] = Z_LVAL_PP(item);\n\t}\n\n\tgdImageSetStyle(im, stylearr, index);\n\n\tefree(stylearr);\n\n\tRETURN_TRUE;\n}", "label": 0, "label_name": "vulnerable"} -{"code": "\tpublic function isAllowedFilename($filename){\n\t\t$allow_array = array(\n\t\t\t'.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp',\n\t\t\t'.mp3','.wav','.mp4',\n\t\t\t'.mov','.webmv','.flac','.mkv',\n\t\t\t'.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso',\n\t\t\t'.pdf','.ofd','.swf','.epub','.xps',\n\t\t\t'.doc','.docx','.wps',\n\t\t\t'.ppt','.pptx','.xls','.xlsx','.txt','.psd','.csv',\n\t\t\t'.cer','.ppt','.pub','.json','.css',\n\t\t\t) ;\n\n\t\t$ext = strtolower(substr($filename,strripos($filename,'.')) ); //\u83b7\u53d6\u6587\u4ef6\u6269\u5c55\u540d\uff08\u8f6c\u4e3a\u5c0f\u5199\u540e\uff09\n\t\tif(in_array( $ext , $allow_array ) ){\n\t\t\treturn true ;\n\t\t}\n\t\treturn false;\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": "\tfunction edit_vendor() {\n\t\t$vendor = new vendor();\n\t\t\n\t\tif(isset($this->params['id'])) {\n\t\t\t$vendor = $vendor->find('first', 'id =' .$this->params['id']);\n\t\t\tassign_to_template(array(\n 'vendor'=>$vendor\n ));\n\t\t}\n\t}", "label": 0, "label_name": "vulnerable"} -{"code": "b,c)))return d;return null},A=function(a,b,c,e,d){if(c){for(var g=0,f;f=a[g];g++){if(f.id==c)return a.splice(g,0,b),b;if(e&&f[e]&&(f=A(f[e],b,c,e,!0)))return f}if(d)return null}a.push(b);return b},B=function(a,b,c){for(var e=0,d;d=a[e];e++){if(d.id==b)return a.splice(e,1);if(c&&d[c]&&(d=B(d[c],b,c)))return d}return null},L=function(a,b){this.dialog=a;for(var c=b.contents,e=0,d;d=c[e];e++)c[e]=d&&new I(a,d);CKEDITOR.tools.extend(this,b)};L.prototype={getContents:function(a){return z(this.contents,", "label": 1, "label_name": "safe"} -{"code": " public function getPath()\n {\n return $this->path;\n }", "label": 0, "label_name": "vulnerable"} -{"code": " function categoryBreadcrumb() {\n// global $db, $router;\n\n //eDebug($this->category);\n\n /*if(isset($router->params['action']))\n {\n $ancestors = $this->category->pathToNode(); \n }else if(isset($router->params['section']))\n {\n $current = $db->selectObject('section',' id= '.$router->params['section']);\n $ancestors[] = $current;\n if( $current->parent != -1 || $current->parent != 0 )\n { \n while ($db->selectObject('section',' id= '.$router->params['section']);)\n if ($section->id == $id) {\n $current = $section;\n break;\n }\n }\n }\n eDebug($sections);\n $ancestors = $this->category->pathToNode(); \n }*/\n\n $ancestors = $this->category->pathToNode();\n // eDebug($ancestors);\n assign_to_template(array(\n 'ancestors' => $ancestors\n ));\n }", "label": 0, "label_name": "vulnerable"} -{"code": " public function isMethodSafe()\n {\n return in_array($this->getMethod(), array('GET', 'HEAD', 'OPTIONS', 'TRACE'));\n }", "label": 1, "label_name": "safe"} -{"code": " public function testInterleaved()\n {\n $this->assertResult(\n 'foobarbaz',\n 'foobarbaz'\n );\n }", "label": 1, "label_name": "safe"} -{"code": "function usercheck_callback_p(data) {\r\n var response = (data == 1);\r\n\r\n var obj = document.getElementById('ajax_output_1');\r\n obj.style.color = (response) ? '#008800' : '#ff0000';\r\n obj.innerHTML = (response == 1) ? 'Username Available' : 'Username already taken';\r\n\r\n var staff_username = document.getElementById(\"USERNAME\").value;\r\n var staff_username_flag = document.getElementById(\"staff_username_flag\").value;\r\n\r\n if(staff_username != '' && staff_username_flag == '0')\r\n {\r\n var obj = document.getElementById('ajax_output_1');\r\n obj.style.color = '#ff0000';\r\n obj.innerHTML = 'Username can only contain letters, numbers, underscores, at the rate and dots';\r\n\r\n window.$(\"#mod_staff_btn\").attr(\"disabled\", true);\r\n }\r\n else\r\n {\r\n window.$(\"#mod_staff_btn\").attr(\"disabled\", false);\r\n }\r\n}\r", "label": 1, "label_name": "safe"} -{"code": "L.length)n();else{var F=L[M];StorageFile.getFileContent(this,F,mxUtils.bind(this,function(G){null==G||\".scratchpad\"==F&&G==this.emptyLibraryXml?x.contentWindow.postMessage(JSON.stringify({action:\"remoteInvoke\",funtionName:\"getLocalStorageFile\",functionArgs:[F]}),\"*\"):y()}),y)}}catch(G){console.log(G)}}),B=mxUtils.bind(this,function(F){try{this.setDatabaseItem(null,[{title:F.title,size:F.data.length,lastModified:Date.now(),type:F.isLib?\"L\":\"F\"},{title:F.title,data:F.data}],y,y,[\"filesInfo\",\"files\"])}catch(G){console.log(G)}});", "label": 0, "label_name": "vulnerable"} -{"code": "void CSecurityTLS::shutdown(bool needbye)\n{\n if (session && needbye)\n if (gnutls_bye(session, GNUTLS_SHUT_RDWR) != GNUTLS_E_SUCCESS)\n vlog.error(\"gnutls_bye failed\");\n\n if (anon_cred) {\n gnutls_anon_free_client_credentials(anon_cred);\n anon_cred = 0;\n }\n\n if (cert_cred) {\n gnutls_certificate_free_credentials(cert_cred);\n cert_cred = 0;\n }\n\n if (session) {\n gnutls_deinit(session);\n session = 0;\n\n gnutls_global_deinit();\n }\n}", "label": 0, "label_name": "vulnerable"} -{"code": " public function testShouldSaveMasterRequestSession()\n {\n $this->sessionHasBeenStarted();\n $this->sessionMustBeSaved();\n\n $this->filterResponse(new Request());\n }", "label": 0, "label_name": "vulnerable"} -{"code": "\t\tpublic function transferPage()\n\t\t{\n\t\t\t//FIXME Put Import code in here. \n\t\t}", "label": 0, "label_name": "vulnerable"} -{"code": " it 'should not contain docroot ' do\n is_expected.not_to contain_file(params[:docroot])\n end", "label": 0, "label_name": "vulnerable"} -{"code": " changePassword: function(newPassword) {\n var d = $q.defer(),\n loginCookie = readLoginCookie();\n\n $http({\n method: 'POST',\n url: '/SOGo/so/changePassword',\n data: {\n userName: loginCookie[0],\n password: loginCookie[1],\n newPassword: newPassword }\n }).then(d.resolve, function(response) {\n var error,\n data = response.data,\n perr = data.LDAPPasswordPolicyError;\n\n if (!perr) {\n perr = passwordPolicyConfig.PolicyPasswordSystemUnknown;\n error = _(\"Unhandled error response\");\n }\n else if (perr == passwordPolicyConfig.PolicyNoError) {\n error = l(\"Password change failed\");\n } else if (perr == passwordPolicyConfig.PolicyPasswordModNotAllowed) {\n error = l(\"Password change failed - Permission denied\");\n } else if (perr == passwordPolicyConfig.PolicyInsufficientPasswordQuality) {\n error = l(\"Password change failed - Insufficient password quality\");\n } else if (perr == passwordPolicyConfig.PolicyPasswordTooShort) {\n error = l(\"Password change failed - Password is too short\");\n } else if (perr == passwordPolicyConfig.PolicyPasswordTooYoung) {\n error = l(\"Password change failed - Password is too young\");\n } else if (perr == passwordPolicyConfig.PolicyPasswordInHistory) {\n error = l(\"Password change failed - Password is in history\");\n } else {\n error = l(\"Unhandled policy error: %{0}\").formatted(perr);\n perr = passwordPolicyConfig.PolicyPasswordUnknown;\n }\n\n d.reject(error);\n });\n return d.promise;\n }", "label": 0, "label_name": "vulnerable"} -{"code": "static int atalk_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,\n\t\t\t size_t size, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct ddpehdr *ddp;\n\tint copied = 0;\n\tint offset = 0;\n\tint err = 0;\n\tstruct sk_buff *skb;\n\n\tskb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,\n\t\t\t\t\t\tflags & MSG_DONTWAIT, &err);\n\tlock_sock(sk);\n\n\tif (!skb)\n\t\tgoto out;\n\n\t/* FIXME: use skb->cb to be able to use shared skbs */\n\tddp = ddp_hdr(skb);\n\tcopied = ntohs(ddp->deh_len_hops) & 1023;\n\n\tif (sk->sk_type != SOCK_RAW) {\n\t\toffset = sizeof(*ddp);\n\t\tcopied -= offset;\n\t}\n\n\tif (copied > size) {\n\t\tcopied = size;\n\t\tmsg->msg_flags |= MSG_TRUNC;\n\t}\n\terr = skb_copy_datagram_iovec(skb, offset, msg->msg_iov, copied);\n\n\tif (!err && msg->msg_name) {\n\t\tstruct sockaddr_at *sat = msg->msg_name;\n\t\tsat->sat_family = AF_APPLETALK;\n\t\tsat->sat_port = ddp->deh_sport;\n\t\tsat->sat_addr.s_node = ddp->deh_snode;\n\t\tsat->sat_addr.s_net = ddp->deh_snet;\n\t\tmsg->msg_namelen = sizeof(*sat);\n\t}\n\n\tskb_free_datagram(sk, skb);\t/* Free the datagram. */\n\nout:\n\trelease_sock(sk);\n\treturn err ? : copied;\n}", "label": 1, "label_name": "safe"} -{"code": " isExpOperator: function(ch) {\n return (ch === '-' || ch === '+' || this.isNumber(ch));\n },", "label": 0, "label_name": "vulnerable"} -{"code": "var CommentsWindow=function(b,e,f,c,m,n){function v(){for(var K=O.getElementsByTagName(\"div\"),F=0,H=0;HassertResult(\n '