reference - What does &variable as a expression mean in c -



reference - What does &variable as a expression mean in c -

this snippet of programme code :

char authenticated = 0; char guard1 = 234; char guard2 = 234; //more variables initliased... char buf[128]; &authenticated; &guard1; &guard2;

so mean when reference stands there single look in programme code?

edit: more context : it's compiled gcc on debian server , it's related security project, can overflow buf array.

given security project, guess these statements designed prevent compiler optimizing away authenticated, guard1, , guard2 variables. if these variables aren't used later on in function, compliant c compiler optimize them away, changing layout of stack frame function call.

technically speaking, since these statements have no side-effects, compiler in principle optimize them away well. however, sense intended compiler doesn't (not couldn't it, can't it). way, layout of stack frame have authenticated variable shielded 2 char values not null terminators, potentially making bit trickier overwrite authenticated. of course, sounds assignment alter authenticated, it's not foolproof. :-)

hope helps!

c reference

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -