From 4bef56feb9ad83249e4254a541daf4aff274e450 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Fri, 31 Aug 2012 15:08:05 -0700 Subject: Added several assertions. --- src/map/amap/amapLiberty.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/map/amap/amapLiberty.c') diff --git a/src/map/amap/amapLiberty.c b/src/map/amap/amapLiberty.c index e3391e66..bd554f8d 100644 --- a/src/map/amap/amapLiberty.c +++ b/src/map/amap/amapLiberty.c @@ -179,6 +179,7 @@ char * Amap_LibertyTimeStamp() time( <ime ); TimeStamp = asctime( localtime( <ime ) ); 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; -- cgit v1.2.3