diff --git a/src/update/client.c b/src/update/client.c index 2e35d3b495..9eae4d0372 100644 --- a/src/update/client.c +++ b/src/update/client.c @@ -193,10 +193,18 @@ main(int argc, char **argv) ("Usage: upclient [-crypt] [-clear] [-t ] [-verbose]* + [-help]\n"); exit(1); } - } else if (strlen(hostname) == 0) - strcpy(hostname, argv[a]); - else { - strcpy(filename, argv[a]); + } else if (strlen(hostname) == 0) { + if (strlcpy(hostname, argv[a], sizeof(hostname)) + >= sizeof(hostname)) { + fprintf(stderr, "Supplied hostname is too long\n"); + exit(1); + } + } else { + if (strlcpy(filename, argv[a], sizeof(filename)) + >= sizeof(filename)) { + fprintf(stderr, "Supplied filename is too long\n"); + exit(1); + } FilepathNormalize(filename); AddToList(&dirname, filename); }