client.c: fix -Wstringop-overflow warning in cmdline_token()

Calling strncpy() on the variable (and erroneous) calculated token
length in cmdline_token() has caused stringop-overflow warning by
GCC 8. This change fixes the error and replaces strncpy() by
memcpy() to quieten the compiler.
This commit is contained in:
Olaf Bergmann committed 2018-06-05 12:28:40 +02:00
1 parent a5f98ef639
commit 171f25e123
1 file changed
+4 -2
+4 -2
View File
@@ -802,8 +802,10 @@ cmdline_proxy(char *arg) {
static inline void
cmdline_token(char *arg) {
strncpy((char *)the_token.s, arg, min(sizeof(_token_data), strlen(arg)));
the_token.length = strlen(arg);
the_token.length = min(sizeof(_token_data), strlen(arg));
if (the_token.length > 0) {
memcpy((char *)the_token.s, arg, the_token.length);
}
}
static void