Array buffer in perl? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Array buffer in perl?

davidrtgdavidrtg Posts: 95Member
We moved a website from a server onto a laptop. Its got a dealer locator script running on it so when you select a location it displays a list of dealers for that area in a new window. The problem is if you select one location then another on the laptop it displays the old informatino then the new information below it. Which is weird because it reloads the cgi script and doesn't save the previous queried data anywhere.
It works fine on the server side. Its random as to when it will append the information.
Now, if you set the array that is storing the queried information to null at the begining of the script it doesn't have the problem except the first dealer information it displays is blank.
It looks like the array isn't getting cleared each time the script is run but I've never seen that before?

Comments

  • JonathanJonathan Posts: 2,914Member
    : We moved a website from a server onto a laptop. Its got a dealer locator script running on it so when you select a location it displays a list of dealers for that area in a new window. The problem is if you select one location then another on the laptop it displays the old informatino then the new information below it. Which is weird because it reloads the cgi script and doesn't save the previous queried data anywhere.
    : It works fine on the server side. Its random as to when it will append the information.
    : Now, if you set the array that is storing the queried information to null at the begining of the script it doesn't have the problem except the first dealer information it displays is blank.
    : It looks like the array isn't getting cleared each time the script is run but I've never seen that before?
    :
    Hehe...sounds very much like the classic "my script is running under mod_perl and doing weird stuff" problem. You've probably only used the script in CGI mode before, but problems of this nature normally arise when you start to use a script under mod_perl, where stuff gets preserved between executions. Solution: fix the script to account for this, or don't use mod_perl.

    As for "its random", this is because variables are only preserved in the same "thread". If a new "thread" services your request (e.g. one that hasn't run your script before) then it will probably work as normal. After that, the symbol table will have the older stuff in.

    I've often wondered if there are some interesting exploits you can do by stealing data other scripts left hanging around...then, that's me. ;-)

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • davidrtgdavidrtg Posts: 95Member
    : : We moved a website from a server onto a laptop. Its got a dealer locator script running on it so when you select a location it displays a list of dealers for that area in a new window. The problem is if you select one location then another on the laptop it displays the old informatino then the new information below it. Which is weird because it reloads the cgi script and doesn't save the previous queried data anywhere.
    : : It works fine on the server side. Its random as to when it will append the information.
    : : Now, if you set the array that is storing the queried information to null at the begining of the script it doesn't have the problem except the first dealer information it displays is blank.
    : : It looks like the array isn't getting cleared each time the script is run but I've never seen that before?
    : :
    : Hehe...sounds very much like the classic "my script is running under mod_perl and doing weird stuff" problem. You've probably only used the script in CGI mode before, but problems of this nature normally arise when you start to use a script under mod_perl, where stuff gets preserved between executions. Solution: fix the script to account for this, or don't use mod_perl.
    :
    : As for "its random", this is because variables are only preserved in the same "thread". If a new "thread" services your request (e.g. one that hasn't run your script before) then it will probably work as normal. After that, the symbol table will have the older stuff in.
    :
    : I've often wondered if there are some interesting exploits you can do by stealing data other scripts left hanging around...then, that's me. ;-)
    :
    : Jonathan
    :
    : ###
    : for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    : (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    : /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");
    :
    :

    Yup, mod_perl was installed on the laptop and I that'll be it. Guess I will remove/uninstall mod_perl and see what happens =)

    If its leaving that data behind I wouldn't doubt that you could go in and grab the data. I wonder if they are aware of this problem?

    Thanks again,
    David


  • mdw1982mdw1982 Posts: 124Member
    : : : We moved a website from a server onto a laptop. Its got a dealer locator script running on it so when you select a location it displays a list of dealers for that area in a new window. The problem is if you select one location then another on the laptop it displays the old informatino then the new information below it. Which is weird because it reloads the cgi script and doesn't save the previous queried data anywhere.
    : : : It works fine on the server side. Its random as to when it will append the information.
    : : : Now, if you set the array that is storing the queried information to null at the begining of the script it doesn't have the problem except the first dealer information it displays is blank.
    : : : It looks like the array isn't getting cleared each time the script is run but I've never seen that before?
    : : :
    : : Hehe...sounds very much like the classic "my script is running under mod_perl and doing weird stuff" problem. You've probably only used the script in CGI mode before, but problems of this nature normally arise when you start to use a script under mod_perl, where stuff gets preserved between executions. Solution: fix the script to account for this, or don't use mod_perl.
    : :
    : : As for "its random", this is because variables are only preserved in the same "thread". If a new "thread" services your request (e.g. one that hasn't run your script before) then it will probably work as normal. After that, the symbol table will have the older stuff in.
    : :
    : : I've often wondered if there are some interesting exploits you can do by stealing data other scripts left hanging around...then, that's me. ;-)
    : :
    : : Jonathan
    : :
    : : ###
    : : for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    : : (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    : : /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");
    : :
    : :
    :
    : Yup, mod_perl was installed on the laptop and I that'll be it. Guess I will remove/uninstall mod_perl and see what happens =)
    :
    : If its leaving that data behind I wouldn't doubt that you could go in and grab the data. I wonder if they are aware of this problem?
    :
    : Thanks again,
    : David

    David, why not just clear the array just after the data the array contains is displayed? Then it will run on mod_perl and non-mod_perl systems.
    --
    Mark
    "If I can't code I'm not going to be a happy camper!"

  • davidrtgdavidrtg Posts: 95Member
    :
    : David, why not just clear the array just after the data the array contains is displayed? Then it will run on mod_perl and non-mod_perl systems.
    : --
    : Mark
    : "If I can't code I'm not going to be a happy camper!"
    :
    :

    Good idea! I'll throw that in. Going to have to start making a sub to clear arrays =P
  • JonathanJonathan Posts: 2,914Member
    : : David, why not just clear the array just after the data the array
    : : contains is displayed? Then it will run on mod_perl and non-
    : : mod_perl systems.
    mod_perl gives a great performance benefit if you are prepared to put in the work to make your scripts to run under it. Weird things can happen, so you generally need pretty thorough testing. If there are a lot of things to change, it may be easier just not to use mod_perl.

    Also be aware that there are two ways to run mod_perl, one of them will clear up after scripts and should (at least in theory) run them like they'd run in CGI mode, with *some* performance increase. But for the full-blown power of mod_perl you need to do the clear-up.

    : Good idea! I'll throw that in. Going to have to start making a sub
    : to clear arrays =P
    :
    A sub?

    @array = ();

    What you need the sub for?!

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • JonathanJonathan Posts: 2,914Member
    : If its leaving that data behind I wouldn't doubt that you could go
    : in and grab the data. I wonder if they are aware of this problem?
    :
    They're very aware, but this is a case of "it just works this way" rather than a problem. It all depends on your point of view. :-)

    I'm not certain, but I *think* seperate "threads" will handle each virtual domain, so spilling should at least be limited to each of those. That's not so bad, if you have a one-site-per-domain approach.

    Jonathan


    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Sign In or Register to comment.