JK2 & JK3 Forcestring server crash Fix

Miscellaneous programs and scripts, opensource or not, and sometimes, random mathematical stuff.
User avatar
evan1715
Posts: 95
Joined: Fri Nov 09, 2007 11:51 pm
Location: Florida
Contact:

Re: JK2 & JK3 Forcestring server crash Fix

Post by evan1715 »

is there any possible way u can remove the example on how to crash it pisses me off soooooo badly, like just edit ur readme and stuff so people have a clue what it is but don't know how to do it, please? u may have fixed it for JA 1.01 and JK2 1.03/1.04 but u have just completely ruined JA 1.0 and JK2 1.02 when u posted that, in jk2 1.02 u can delete forcechanged cmd for a work-around, but theres a way to still crash with it... in JA 1.0 if u try to delete the cmd it'll still crash no matter what happens! it's like the ja 1.0 model crash, theres no work around like the galak crash in jk2 1.02, JA 1.0 is way more vulnerable to crash
Gamall
Hic sunt dracones
Posts: 4174
Joined: Fri May 26, 2006 11:09 pm
Contact:

Re: JK2 & JK3 Forcestring server crash Fix

Post by Gamall »

No. This has already been discussed.

What happens to outdated versions of the game, which should have ceased to exist years ago, is a moot point from a security standpoint. Besides, those versions have a whole lot of other, as efficient, better known crashes to worry about...

On a side note, I'll just say that in my personal opinion, the fragmentation of the communities between the different versions has caused and is causing much more damage to the games than the bugs and crashes alone ever will. Raven's asinine patching policy did not help either. They should have tuned the master-servers to reject out-of-date servers a week or so after each patch came out. That way everybody would have (willy-nilly) updated right then, all crashes would have been fixed much more easily, and the communities would be much stronger now instead of staying divided.

Moreover, there never was any technical reason not to update. The worst thing that could happen if a crash such as this one becomes extremely widespread is that people will at last be forced to update en masse to the current, moddable versions of both games.

And this would actually strengthen the gaming communities.
{<§ Gamall Wednesday Ida §>}
{ Mods and Programs - Mods TES-IV Oblivion }
User avatar
evan1715
Posts: 95
Joined: Fri Nov 09, 2007 11:51 pm
Location: Florida
Contact:

Re: JK2 & JK3 Forcestring server crash Fix

Post by evan1715 »

Gamall wrote:Moreover, there never was any technical reason not to update. The worst thing that could happen if a crash such as this one becomes extremely widespread is that people will at last be forced to update en masse to the current, moddable versions of both games.

And this would actually strengthen the gaming communities.
k here is where u could be right about JA but not jk2.. the difference between jk2 1.02 and jk2 1.04 is so massive that people would rather quit the game than update to 1.04 and i know that for a fact. once a crash gets "widespread" people try to fix it, if fixes the crashers are like "oh my god what do we do now!" and they go search for other crashes and bring in more and more crashes. like in jk2 1.02.... so anyway u could be right about ja, but not jk2.
Gamall
Hic sunt dracones
Posts: 4174
Joined: Fri May 26, 2006 11:09 pm
Contact:

Re: JK2 & JK3 Forcestring server crash Fix

Post by Gamall »

evan1715 wrote:the difference between jk2 1.02 and jk2 1.04 is so massive that people would rather quit the game than update to 1.04 and i know that for a fact.
Really ? I read the history of the patches and didn't see anything absolutely dramatic.

I assume you are talking about gameplay differences ? Even assuming there really is a notable difference between the versions, this is not a dealbreaker since those changes can be unmade in a mod for 1.04 in order to get 1.02 gameplay without the crashes.

Now that would be a constructive way of "saving the JK2 1.02 community", instead of wasting time trying to get half-backed hex hacks fixing things which are trivially fixed in a mod or were fixed by official patches long ago.
evan1715 wrote:once a crash gets "widespread" people try to fix it, if fixes the crashers are like "oh my god what do we do now!" and they go search for other crashes and bring in more and more crashes. like in jk2 1.02
Except many bugs simply can't be fixed in 1.02, which was your very own point to start with. So people wanting to crash a 1.02 server really do not need to know more than one unfixable bug: for instance the /say aaaaa crash, which has no binary fix I'm aware of for Linux servers as of yet. (and most dedicated servers are hosted on Linux). Or the model thingy. Or or or.
{<§ Gamall Wednesday Ida §>}
{ Mods and Programs - Mods TES-IV Oblivion }
User avatar
evan1715
Posts: 95
Joined: Fri Nov 09, 2007 11:51 pm
Location: Florida
Contact:

Re: JK2 & JK3 Forcestring server crash Fix

Post by evan1715 »

"I read the history of the patches and didn't see anything absolutely dramatic. "
are u kidding? everything changes in 1.04, play 1.02 then play 1.04, u may not be able to read it but u will see it

ok every idea u may have ive already thought it out... and the problem with that 1 is how am i going to get 500 people to update to 1.04 and only use my mod?
don't even have to go to 1.04, just go to 1.03... no1 will do it unless everyone does it, which ive tried and no1 wants to. do u want to try and change people's minds urself? and no most servers on jk2 1.02 are windows. mainly hosted by Art of War or NoGhost or a europe server located in germany but i forgot their website and they are also windows servers
User avatar
evan1715
Posts: 95
Joined: Fri Nov 09, 2007 11:51 pm
Location: Florida
Contact:

Re: JK2 & JK3 Forcestring server crash Fix

Post by evan1715 »

in bg_misc.c theres a thing called "BG_LegalizedForcePowers" search for that and i think they try and attempt to prevent the force crash there :P is there a shorter way to fix it there? :lol
Gamall
Hic sunt dracones
Posts: 4174
Joined: Fri May 26, 2006 11:09 pm
Contact:

Re: JK2 & JK3 Forcestring server crash Fix

Post by Gamall »

Nope, what they do is check whether the player can "afford" the powers. They make some vague attempts to prevent bogus strings to get in, but it's not efficient. It's not the right place to do it either.
{<§ Gamall Wednesday Ida §>}
{ Mods and Programs - Mods TES-IV Oblivion }
User avatar
evan1715
Posts: 95
Joined: Fri Nov 09, 2007 11:51 pm
Location: Florida
Contact:

Re: JK2 & JK3 Forcestring server crash Fix

Post by evan1715 »

OOOH ok i guess i misunderstood what it was :P
User avatar
evan1715
Posts: 95
Joined: Fri Nov 09, 2007 11:51 pm
Location: Florida
Contact:

Re: JK2 & JK3 Forcestring server crash Fix

Post by evan1715 »

did u ever test g_maxforcerank 200 in JA?
i did recently and the server crashes :S i guess that 'bug' only works for JK2, but geez do i love having unlimited force powers :D

also, u can still put the fix in bg_misc.c\BG_LegalizedForcePowers right?
Gamall
Hic sunt dracones
Posts: 4174
Joined: Fri May 26, 2006 11:09 pm
Contact:

Re: JK2 & JK3 Forcestring server crash Fix

Post by Gamall »

evan1715 wrote:did u ever test g_maxforcerank 200 in JA?
No, I did not.
evan1715 wrote:also, u can still put the fix in bg_misc.c\BG_LegalizedForcePowers right?
We discussed that already (look two posts up). You can put the fix wherever the hell you want --- so long as it works, but I see no point in it, unless there is a flow of execution where this is executed before WP_InitForcePowers, and there doesn't seem to be.
{<§ Gamall Wednesday Ida §>}
{ Mods and Programs - Mods TES-IV Oblivion }
User avatar
evan1715
Posts: 95
Joined: Fri Nov 09, 2007 11:51 pm
Location: Florida
Contact:

Re: JK2 & JK3 Forcestring server crash Fix

Post by evan1715 »

no we did not discuss if it would work in bg_legalizeforcepowers, i asked if it was ravensoft attempt to fix it, and u corrected me saying it was so clients could afford their forcepowers

im asking because ensiform put it his there when everyone else didn't o_o, lucas forums - ja coding he said it works but i was just asking from another person's point of view which one would be better
Gamall
Hic sunt dracones
Posts: 4174
Joined: Fri May 26, 2006 11:09 pm
Contact:

Re: JK2 & JK3 Forcestring server crash Fix

Post by Gamall »

I chose to do it in WP_InitForcePower, and it worked well. But it see no reason why it wouldn't work just as well in BG_LegalizedForcePowers.

In both cases, you need only one check to solve the problem. Where you choose to do that check is mainly a matter of personal taste IMHO :?

What I don't get is why you are still messing with that problem: it seems at first glance that you have no less than three different fixes to choose from: mine, hex's and ensiform's. I know mine works, I assume the other two work as well.

Just pick the first one which works for you (or the one which pleases your aesthetic fibre most) and move on to something more interesting, no ? :haha
{<§ Gamall Wednesday Ida §>}
{ Mods and Programs - Mods TES-IV Oblivion }
User avatar
evan1715
Posts: 95
Joined: Fri Nov 09, 2007 11:51 pm
Location: Florida
Contact:

Re: JK2 & JK3 Forcestring server crash Fix

Post by evan1715 »

i'm not interested in it, out of all 3 urs is the best because it supports g_maxforcerank "200" and hex's doesn't,
newage(clan mod creator) wants me to switch the anti force crash because he thinks it's the anti force crash thats causing his server to have random crashes, but i don't think it is but i'm like "whatever it's your mod" so he wants me to use master hex's, i really don't think it is because on my server(s) they're fine
well, and i think he wants me to use hex's because u have the license on urs :S
what u saw earlier when i showed u this: http://www.lucasforums.com/showpost.php ... tcount=107 a while ago, he uses on his JA version and not JO... thats all
also some off topic stuff: good news for you & me (kind of)
1. my birthday was sunday (im sure it wouldnt matter to u anyway because 2 different continents but i like to let people know :P)
2. i've learned some more stuff about C over the time :haha :super
Gamall
Hic sunt dracones
Posts: 4174
Joined: Fri May 26, 2006 11:09 pm
Contact:

Re: JK2 & JK3 Forcestring server crash Fix

Post by Gamall »

evan1715 wrote:newage(clan mod creator) wants me to switch the anti force crash because he thinks it's the anti force crash thats causing his server to have random crashes
I am quite sure the "standard" (mak force rank 7) fix is correct.

edit: Neverming what follows: problem is solved in next post :P

But I have just made some more tests and asserted that the maxforcerank 200 fix is not totally correct. (I don't think this might cause "random" crashes though...) :snif Haaa, if C had built-in support for regular expressions... *dreams on*

Here is a simple testing program for both fixes:

Code: Select all

#include <stdio.h>
#include <string.h>  

/*
  * Gamall Wednesday Ida
  * Workaround Force crash
  * License GPL.
  */

// if the force string is incorrect, this one will be used
char  *SgaGENERIC_FORCE   = "7 BOGUS";
// masks: no values outside these boundaries will be accepted
char  *SgaFORCE_LOWER    = "0-1-000000000000000000";
char  *SgaFORCE_UPPER    = "7-2-333333333333333333";

char* SgaCheckForceString(char* s) {
    char *p = s, *pu = SgaFORCE_UPPER, *pl = SgaFORCE_LOWER;
    if (!s || strlen(s) != 22) return SgaGENERIC_FORCE;
    while(*p) {if (*p > *pu++ || *p++ < *pl++) {return SgaGENERIC_FORCE;}}
    return s;   
}
      
       

/*
 * Gamall Wednesday Ida
 * Workaround Force crash
 * License GPL.
 *
 * Version modified to allow 'tweaked" settings
 * like "g_maxforcerank 200".
 */
 


char  *gaGENERIC_FORCE    = "200 BOGUS";
char  *gaFORCE_LOWER     = "-1-000000000000000000";
char  *gaFORCE_UPPER     = "-2-333333333333333333";


char* gaCheckForceStringTail(char* s, char* S) {
    char *p = s, *pu = gaFORCE_UPPER, *pl = gaFORCE_LOWER;
    if (!s || strlen(s) != 21) return gaGENERIC_FORCE;
    while(*p) {if (*p > *pu++ || *p++ < *pl++) {return gaGENERIC_FORCE;}}
    return S;    
}

char* gaCheckForceString(char* S) {
    int i, l; char *p = S;
    if (!S || (l = strlen(S)) > 24 || l < 22  || *S < '\0' || *S > '9') return gaGENERIC_FORCE;
    for(i = 1 ; i <= 3 ; i++) {
        if (S[i] == '-') return gaCheckForceStringTail(S+i, S);
        if (S[i] < '\0' || S[i] > '9') break;
    } return gaGENERIC_FORCE;
}

// GWI: End Force Crash workaround. 
          
// Testing the workaround
int main()
{
  int i;
  char * tests[] =
  {
    "7-1-033330000000000333",
    "I am so obviously bogus",
    "-1-033330100000020333",
    "1-033330010002000333",
    "-033330000200000333",
    "033330020000100333",
    "a-1-033330000000000333",
    "8-1-033330000000000333",
    "0-1-033330000000000333",
    "7-0-033330000000000333",
    "7-4-033330000000000333",
    "5-c-033330000000000333",
    "1-2-033330000000000333",
    "1-2-03333000000000333",
    "1-2-033330040000000333",
    "4-2-012030201010202010",
    "4-2-111111111122223310",
    "----------------------",
    "200-2-111111111122223310",
    "445-2-111111111122223310",
    "199-2-111111111122223310",
    "-4-2-111111111122223310",
    "-14-2-111111111122223310",
    "-94-2-111111111122223310",
    "-994-2-111111111122223310",
    ""
  };
  
  printf("\n\nMAX FORCE RANK FIXES TESTS\n\n");
  i = -1;
  while(*tests[++i])
  {
    printf("(%2d) %25s    ---> %25s   ---> %25s\n", i, tests[i], 
           gaCheckForceString(tests[i]),  SgaCheckForceString(tests[i]));
  }

  
};
 
And here are the results:

Code: Select all

MAX FORCE RANK FIXES TESTS

( 0)    7-1-033330000000000333    --->    7-1-033330000000000333   --->    7-1-033330000000000333
( 1)   I am so obviously bogus    --->                 200 BOGUS   --->                   7 BOGUS
( 2)     -1-033330100000020333    --->                 200 BOGUS   --->                   7 BOGUS
( 3)      1-033330010002000333    --->                 200 BOGUS   --->                   7 BOGUS
( 4)       -033330000200000333    --->                 200 BOGUS   --->                   7 BOGUS
( 5)        033330020000100333    --->                 200 BOGUS   --->                   7 BOGUS
( 6)    a-1-033330000000000333    --->                 200 BOGUS   --->                   7 BOGUS
( 7)    8-1-033330000000000333    --->    8-1-033330000000000333   --->                   7 BOGUS
( 8)    0-1-033330000000000333    --->    0-1-033330000000000333   --->    0-1-033330000000000333
( 9)    7-0-033330000000000333    --->                 200 BOGUS   --->                   7 BOGUS
(10)    7-4-033330000000000333    --->                 200 BOGUS   --->                   7 BOGUS
(11)    5-c-033330000000000333    --->                 200 BOGUS   --->                   7 BOGUS
(12)    1-2-033330000000000333    --->    1-2-033330000000000333   --->    1-2-033330000000000333
(13)     1-2-03333000000000333    --->                 200 BOGUS   --->                   7 BOGUS
(14)    1-2-033330040000000333    --->                 200 BOGUS   --->                   7 BOGUS
(15)    4-2-012030201010202010    --->    4-2-012030201010202010   --->    4-2-012030201010202010
(16)    4-2-111111111122223310    --->    4-2-111111111122223310   --->    4-2-111111111122223310
(17)    ----------------------    --->                 200 BOGUS   --->                   7 BOGUS
(18)  200-2-111111111122223310    --->  200-2-111111111122223310   --->                   7 BOGUS
(19)  445-2-111111111122223310    --->  445-2-111111111122223310   --->                   7 BOGUS
(20)  199-2-111111111122223310    --->  199-2-111111111122223310   --->                   7 BOGUS
(21)   -4-2-111111111122223310    --->   -4-2-111111111122223310   --->                   7 BOGUS
(22)  -14-2-111111111122223310    --->  -14-2-111111111122223310   --->                   7 BOGUS
(23)  -94-2-111111111122223310    --->  -94-2-111111111122223310   --->                   7 BOGUS
(24) -994-2-111111111122223310    --->                 200 BOGUS   --->                   7 BOGUS
It is clear there that though the 7 fix does its job, the 200 fix fails on 21, 22 and 23.

I should have tested the 200 fix more before releasing the code. Mea culpa :fuite

I'll fix that when I get time... don't know when that will be. (well, right now it's not as much a matter of "free time" as a matter of "free mind", to be honest :?)
evan1715 wrote:1. my birthday was sunday (im sure it wouldnt matter to u anyway because 2 different continents but i like to let people know )
My own birthday does not matter to me so... But happy birthday anyway :langue
evan1715 wrote:2. i've learned some more stuff about C over the time
*grumbles something about books...*
{<§ Gamall Wednesday Ida §>}
{ Mods and Programs - Mods TES-IV Oblivion }
Gamall
Hic sunt dracones
Posts: 4174
Joined: Fri May 26, 2006 11:09 pm
Contact:

Re: JK2 & JK3 Forcestring server crash Fix

Post by Gamall »

I was thinking about something else when I read that code again... then I banged my head on the walls :edr :edr :edr :edr :edr

In line

Code: Select all

if (!S || (l = strlen(S)) > 24 || l < 22  || *S < '\0' || *S > '9') return gaGENERIC_FORCE; 
remove the backslash in '\0'... which does not make sense

it becomes

Code: Select all

if (!S || (l = strlen(S)) > 24 || l < 22  || *S < '0' || *S > '9') return gaGENERIC_FORCE; 
And this time it seems to work properly.

You must just love what you can do with a simple typo :haha

edit: And the same typo is also in line

Code: Select all

if (S[i] < '0' || S[i] > '9') break; 
I have edited the post where I give the code.

Here is the test code:
forcefixtest.c
(2.64 KiB) Downloaded 1616 times
{<§ Gamall Wednesday Ida §>}
{ Mods and Programs - Mods TES-IV Oblivion }
Post Reply

Who is online

Users browsing this forum: Google Adsense [Bot] and 52 guests