Fix truncate string on STRCP_TO macro.

The macro STRCP_TO copies a c_str into a char buffer, it won't
copy more that sizeof(charb), however, the resulting string will
be truncated. Although this is expected, the resulting string
won't have a NULL terminator.

Story: 2003497
Task: 24774

Change-Id: I249c75af897ba02837ad6d3981d976c291e88aea
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
This commit is contained in:
Erich Cordoba 2018-08-20 12:01:50 -05:00
parent c8159ea6cb
commit 586369fa6d
1 changed files with 1 additions and 1 deletions

View File

@ -42,7 +42,7 @@ static stoi_t err_to_int;
((str).length()==1 && ((str).c_str())[0]==' ')) { \
memset(charb,0,sizeof(charb)); \
} else { \
strncpy((charb),str.c_str(),sizeof(charb)); \
snprintf(charb, sizeof(charb)-1, "%s", str.c_str()); \
}
void add_both_tables(int id, const char *str, itos_t &t1,stoi_t &t2 ) {