Version 16.118.2

This commit is contained in:
Antonio Cañas Vargas 2017-01-17 10:06:52 +01:00
parent bde39748d4
commit 89d88b5f90
2 changed files with 10 additions and 6 deletions

View File

@ -191,13 +191,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.118.1 (2017-01-16)"
#define Log_PLATFORM_VERSION "SWAD 16.118.2 (2017-01-17)"
#define CSS_FILE "swad16.111.5.css"
#define JS_FILE "swad16.114.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/*
Version 16.118.2: Jan 17, 2017 Fix bug in string concatenation. (? lines)
Version 16.118.1: Jan 17, 2017 Code refactoring related to string concatenation. (211850 lines)
Version 16.118: Jan 17, 2017 Code refactoring related to string copy. (211676 lines)
Version 16.117.1: Jan 16, 2017 Code refactoring related to string concatenation. (211229 lines)

View File

@ -2837,15 +2837,15 @@ void Str_Copy (char *Dst,const char *Src,size_t DstSize)
{
size_t LengthSrc = strlen (Src);
if (DstSize < LengthSrc)
/***** Check if buffer has enough space for source *****/
if (LengthSrc > DstSize)
{
sprintf (Gbl.Message,"Trying to copy %lu chars into a %lu-chars buffer.",
LengthSrc,DstSize);
Lay_ShowErrorAndExit (Gbl.Message);
}
// strncpy (Dst,Src,MaxLength);
// Dst[MaxLength] = '\0';
/***** Copy source into destination *****/
strcpy (Dst,Src);
}
@ -2859,14 +2859,17 @@ void Str_Concat (char *Dst,const char *Src,size_t DstSize)
size_t LengthSrc;
size_t FreeSpace;
/***** Check if buffer has already overflowed *****/
LengthDst = strlen (Dst);
if (LengthDst > DstSize)
{
sprintf (Gbl.Message,"%lu-chars buffer has %lu chars!",
DstSize,LengthSrc);
DstSize,LengthDst);
Lay_ShowErrorAndExit (Gbl.Message);
}
/***** Check if buffer has enough space for source *****/
// DstSize >= LengthDst ==> FreeSpace >= 0
FreeSpace = DstSize - LengthDst;
LengthSrc = strlen (Src);
if (FreeSpace < LengthSrc)
@ -2876,6 +2879,6 @@ void Str_Concat (char *Dst,const char *Src,size_t DstSize)
Lay_ShowErrorAndExit (Gbl.Message);
}
// strncat (Dst,Src,FreeSpace);
/***** Concatenate ******/
strcat (Dst,Src);
}