Skip to content

Commit

Permalink
Fix GCC -Wstringop-truncation
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed May 14, 2020
1 parent ce96967 commit cdfeceb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libmariadb/ma_charset.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/****************************************************************************
Copyright (C) 2012 Monty Program AB
Copyright (C) 2012, 2020, MariaDB Corporation.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
Expand Down Expand Up @@ -1403,7 +1403,8 @@ static void map_charset_name(const char *cs_name, my_bool target_cs, char *buffe
else
{
/* Not our client - copy as is*/
strncpy(buffer, cs_name, buff_len);
strncpy(buffer, cs_name, buff_len - 1);
buffer[buff_len - 1]= '\0';
}

if (target_cs)
Expand Down

0 comments on commit cdfeceb

Please sign in to comment.