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.

arrays, vectors and hackers

I was told that if you dont put something at the end of an array to tell the array that that is the end of the array then hackers would be able to minipulate the array and destroy the program and cause the computer to crash.

now i see vectors, which im not clear on except that they are flexible in size as the program goes along.

arrays are vunerable as it is, but what stops a vector from being vunerable to hackers?

arrays have something that says that the array stops here but how does a vector tell the computer that a vector is at its end? if it has an end.

I feel that vectors are more vunerable to hacking than arrays or am i incorrect.

which is better? an array or a vector?

thank you

Comments

  • MT2002MT2002 Posts: 1,444Member
    [b][red]This message was edited by MT2002 at 2006-1-26 19:13:21[/red][/b][hr]
    : I was told that if you dont put something at the end of an array to tell the array that that is the end of the array then hackers would be able to minipulate the array and destroy the program and cause the computer to crash.
    :
    : now i see vectors, which im not clear on except that they are flexible in size as the program goes along.
    :
    : arrays are vunerable as it is, but what stops a vector from being vunerable to hackers?
    :
    : arrays have something that says that the array stops here but how does a vector tell the computer that a vector is at its end? if it has an end.
    [blue]
    Arrays dont have anything that states where it stops. It is very
    easy (and common) to overide an arrays bounds.
    [/blue]
    : I feel that vectors are more vunerable to hacking than arrays or am i incorrect.
    :
    : which is better? an array or a vector?
    [blue]
    I personally prefer STLs vector for its extensibility, ease
    of use, more safer, and is dynamically sized.
    [/blue]
    : thank you
    :
    [blue]
    vectors are basically linked lists (which is an idiom for creating
    dynamic size arrays). Im assuming you are referring to the STL
    vector class ADT, of course.

    Some systems have memory managers. Everything that requires
    memory are handled here by "Memory blocks". when allocating/
    deallocating memory, some systems place "dog tags" (I think
    thats what they are called), within each memory allocation.
    The dog tag is just a number that should never change. If it
    changes, you could saftely assume the heap was corrupted.
    (Which means a possible virii/worm, or other hacking tool.
    --Or just a nasty memory curruption.)

    Arrays are just pointers to heap memory, so that applies with
    the above.

    edit: Dog tags are typically used for debugging purposes
    for heap curruption, so it may be usefull here.

    If this is a small system, and/or hackers aren't a threat,
    then I wouldnt worry much about it.

    Hope this is helpful,
    ~mt2002[/blue]
    [hr][italic]"There are ten kinds of people in the world--Those who speak binary, and those who dont!"[/italic]



  • zeroscspotzeroscspot Posts: 40Member
    I went back and looked at my book and it teaches stl vectors, so ill do all right with that when i get to it.
Sign In or Register to comment.