8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 10:03:03 +01:00

Adriano says we shouldn't assume argv[argc] is null.

This commit is contained in:
robocop 2009-11-09 06:19:47 +00:00
parent 9f87c75553
commit b58ac3f91d

View File

@ -6951,10 +6951,9 @@ static processing_state parse_arg(int argc, SCHAR** argv, SCHAR* tabname)
switch_used[su] = false;
}
int i = 1;
const char* s = argv[i];
while (i < argc)
for (int i = 1; i < argc; ++i)
{
const char* s = argv[i];
// Look at flags to find unique match. If the flag has an arg,
// advance the pointer (and i). Only change the return value
// for extract switch or error.
@ -6987,7 +6986,8 @@ static processing_state parse_arg(int argc, SCHAR** argv, SCHAR* tabname)
if (switches[j].argtype != SWARG_NONE)
{
// make sure swarg_str is really a pointer to argv, not something else !!
swarg_str = argv[++i];
if (++i < argc)
swarg_str = argv[i];
if (!swarg_str || !*swarg_str)
{
ISQL_msg_get(USAGE_NOARG, errbuf, SafeArg() << (s + 1));
@ -7247,7 +7247,7 @@ static processing_state parse_arg(int argc, SCHAR** argv, SCHAR* tabname)
fb_utils::copy_terminate(isqlGlob.global_Db_name, s, sizeof(isqlGlob.global_Db_name));
#ifdef DEV_BUILD
// If there is a table name, it follows
if (istable && (s = argv[++i]) && *s)
if (istable && (++i < argc) && (s = argv[i]) && *s)
fb_utils::copy_terminate(tabname, s, WORDLENGTH);
#endif
}
@ -7256,8 +7256,6 @@ static processing_state parse_arg(int argc, SCHAR** argv, SCHAR* tabname)
// Quit the loop of interpreting if we got an error
if (ret == ps_ERR)
break;
s = argv[++i];
}
// If not input, then set up first filelist