arrays, vectors and hackers - Programmers Heaven

#### Howdy, Stranger!

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

# arrays, vectors and hackers

Posts: 40Member
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

• 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

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.