mirror of
https://github.com/fltk/fltk.git
synced 2026-06-02 07:26:57 +08:00
Fix potential invalid stack variable access in test code
This code was (and is still) commented out but it *would* trigger a "stack buffer overflow" error *if* uncommented. The new code demonstrates how a binary object (Fl_Preferences 'bed') can be dumped to a preferences file in binary format (if activated).
This commit is contained in:
+6
-3
@@ -471,7 +471,10 @@ Function {writePrefs()} {open return_type void
|
|||||||
fl_message( "Assertion failed:\\nNot all group entries were found!" );
|
fl_message( "Assertion failed:\\nNot all group entries were found!" );
|
||||||
|
|
||||||
/* sample code only: */
|
/* sample code only: */
|
||||||
//unsigned int hex = 0x2387efcd;
|
// unsigned int hex = 0xefbeadde;
|
||||||
//eat.set( "binFoo", (void*)&hex, sizeof( unsigned int ) );
|
// unsigned int size_of_bed = sizeof( bed ); // size of Fl_Preferences 'bed'
|
||||||
//eat.set( "binFoo2", (void*)&bed, 256 );} {}
|
// eat.set( "binFoo", (void*)&hex, sizeof( unsigned int ) );
|
||||||
|
// eat.set( "SizeOfBed", (int)size_of_bed );
|
||||||
|
// eat.set( "Prefs_Bed", (void*)&bed, sizeof( bed ) );} {selected
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user