Don't use strncpy() when not needed

It upsets the compiler warnings when you do strncpy() with the
source buffer size as the limit. It is also unnecessary to use
strncpy() here as we just allocated a buffer guaranteed to be
large enough.
This commit is contained in:
Pierre Ossman 2019-04-10 11:11:14 +02:00
parent df94870c91
commit cf95138c9b

View File

@ -836,7 +836,7 @@ main(int argc, char *argv[])
case 'u':
g_username = (char *) xmalloc(strlen(optarg) + 1);
STRNCPY(g_username, optarg, strlen(optarg) + 1);
strcpy(g_username, optarg);
username_option = 1;
break;
@ -1355,7 +1355,7 @@ main(int argc, char *argv[])
STRNCPY(domain, g_redirect_domain, sizeof(domain));
xfree(g_username);
g_username = (char *) xmalloc(strlen(g_redirect_username) + 1);
STRNCPY(g_username, g_redirect_username, strlen(g_redirect_username) + 1);
strcpy(g_username, g_redirect_username);
STRNCPY(server, g_redirect_server, sizeof(server));
flags |= RDP_INFO_AUTOLOGON;