Re: SOLVED OT - C compiler, assignement on double-declared variable with different types

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jesus Sanchez
Date: Sunday, April 11, 2010 - 12:23 am

El 11/04/2010 9:06, patrick keshishian escribis:

Declarations and definitions are very tricky for sure, i mean if you 
define the foo vars
instead of just declaring them, for example doing a initialization for 
all foo vars  on a.c:

char foo=5;
char foo1=5;
char foo2=5;
char foo3=5;

then the thing changes drastically because now they have 0xXXX0, 0xXXX1,
0xXXX2, 0xXXX3 addresses, so on overfoo() function you're doing one
perfect example of buffer overflow, even you can try assigning 0x44332211 to
foo on 'b.c' and print them later, it will show something like

foo value is: 0x11
foo1 value is: 0x22
foo2 value is: 0x33
foo3 value is: 0x44

maybe i didn't explained myself very well, you can try to print the 
addresses
of the foo vars with and without definition.

see ya.
-J

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: SOLVED OT - C compiler, assignement on double-declared ..., patrick keshishian, (Sat Apr 10, 10:49 pm)
Re: SOLVED OT - C compiler, assignement on double-declared ..., patrick keshishian, (Sun Apr 11, 12:06 am)
Re: SOLVED OT - C compiler, assignement on double-declared ..., Jesus Sanchez, (Sun Apr 11, 12:23 am)
Re: OT - C compiler, assignement on double-declared variab ..., patrick keshishian, (Sun Apr 11, 12:27 pm)