Commit 4bef56fe by Alan Mishchenko

Added several assertions.

parent 8c0e0d71
......@@ -179,6 +179,7 @@ char * Amap_LibertyTimeStamp()
time( &ltime );
TimeStamp = asctime( localtime( &ltime ) );
TimeStamp[ strlen(TimeStamp) - 1 ] = 0;
assert( strlen(TimeStamp) < 100 );
strcpy( Buffer, TimeStamp );
return Buffer;
}
......@@ -310,6 +311,7 @@ int Amap_LibertyCellCountOutputs( Amap_Tree_t * p, Amap_Item_t * pCell )
char * Amap_LibertyGetString( Amap_Tree_t * p, Amap_Pair_t Pair )
{
static char Buffer[256];
assert( Pair.End-Pair.Beg < 256 );
strncpy( Buffer, p->pContents+Pair.Beg, Pair.End-Pair.Beg );
Buffer[Pair.End-Pair.Beg] = 0;
return Buffer;
......@@ -329,6 +331,7 @@ char * Amap_LibertyGetString( Amap_Tree_t * p, Amap_Pair_t Pair )
char * Amap_LibertyGetStringFormula( Amap_Tree_t * p, Amap_Pair_t Pair )
{
static char Buffer[256];
assert( Pair.End-Pair.Beg-2 < 256 );
strncpy( Buffer, p->pContents+Pair.Beg+1, Pair.End-Pair.Beg-2 );
Buffer[Pair.End-Pair.Beg-2] = 0;
return Buffer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment