Merge pull request #2503 from pacovn/Coverity_1469898_Uninitialized_scalar_variable

lib: uninitialized variable (2) (Coverity 1469898)
This commit is contained in:
Quentin Young 2018-06-26 11:35:58 -04:00 committed by GitHub
commit cf6bc77d28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -261,8 +261,11 @@ void print_version(const char *progname)
char *argv_concat(struct cmd_token **argv, int argc, int shift)
{
int cnt = argc - shift;
const char *argstr[cnt];
int cnt = MAX(argc - shift, 0);
const char *argstr[cnt + 1];
if (!cnt)
return NULL;
for (int i = 0; i < cnt; i++)
argstr[i] = argv[i + shift]->arg;