Commit 0565882c authored by Simon McVittie's avatar Simon McVittie

safe_strncpy: Work around -Werror=stringop-truncation

Ideally we should bubble up errors to the caller rather than silently
truncating, but if we have to truncate, let's at least be sufficiently
explicit about it that gcc 8 doesn't sulk.
Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
parent b636d25f
......@@ -169,7 +169,7 @@ find_symbol (int idx, const ElfW(Sym) *stab, size_t symsz, const char *str, size
// way about truncation though, should probably fix that:
char *safe_strncpy (char *dest, const char *src, size_t n)
{
char *rv = strncpy( dest, src, n );
char *rv = strncpy( dest, src, n - 1 );
dest[ n - 1 ] = '\0';
return rv;
}
......
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