<commit_before>//------------------------------------------------------------------------------
// Revenge Of The Cats: Ethernet
// Copyright (C) 2008, mEthLab Interactive
//------------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Cookies

function clientCmdCookie(%name, %value)
{
	echo("Got cookie!");
	echo("Name:" SPC %name);
	echo("Value:" SPC %value);

	$Pref::Cookie_[%name] = %value;
}

function clientCmdCookieRequest(%name)
{
	%value = $Pref::Cookie_[%name];
   if(%value !$= "")
   	commandToServer('Cookie', %name, %value);
}
<commit_msg>Try to fix possible way for server to exploit client.<commit_after>//------------------------------------------------------------------------------
// Revenge Of The Cats: Ethernet
// Copyright (C) 2008, mEthLab Interactive
//------------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Cookies

function clientCmdCookie(%name, %value)
{
	echo("Got cookie!");
	echo("Name:" SPC %name);
	echo("Value:" SPC %value);

   // Make sure the server can't interject code into our prefs.cs file!!!
   %legal = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_";
   %len = strlen(%name);
   for(%i = 0; %i < %len; %i++)
   {
      %c = getSubStr(%name, %i, 1);

      if(strpos(%legal, %c) < 0)
      {
         error("Illegal cookie name! Contains" SPC %c);
         return;
      }
   }

	$Pref::Cookie_[%name] = %value;
}

function clientCmdCookieRequest(%name)
{
	%value = $Pref::Cookie_[%name];
   if(%value !$= "")
   	commandToServer('Cookie', %name, %value);
}

{'fraction_non_alphanumeric': 0.40300230946882215, 'fraction_numerical': 0.01212471131639723, 'mean_word_length': 1.3578231292517007, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '740251', 'n_tokens_mistral': 504, 'n_tokens_neox': 460, 'n_words': 109}