/* checking for our files to import or export */
for(i = 0; i < LAST_BANDB_TYPE; i++)
{
- snprintf(conf, sizeof(conf), "%s/%s.conf%s",
- etc, bandb_table[i], bandb_suffix[i]);
+ if (snprintf(conf, sizeof(conf), "%s/%s.conf%s",
+ etc, bandb_table[i], bandb_suffix[i]) >= sizeof(conf)) {
+ fprintf(stderr, "* Error: Config filename too long\n");
+ exit(EXIT_FAILURE);
+ }
if(flag.import && flag.pretend == false)
rsdb_transaction(RSDB_TRANS_START);
NULL
};
- for(i = 0; i < LAST_BANDB_TYPE; i++)
+ for(i = 0; i < LAST_BANDB_TYPE; i += 2 /* skip over _PERM */)
{
if(!table_exists(bandb_table[i]))
{
columns[j], type);
}
}
-
- i++; /* skip over .perm */
}
}
{
int i;
rsdb_transaction(RSDB_TRANS_START);
- for(i = 0; i < LAST_BANDB_TYPE; i++)
+ for(i = 0; i < LAST_BANDB_TYPE; i += 2 /* double increment to skip over _PERM */)
{
rsdb_exec(NULL, "DROP TABLE %s", bandb_table[i]);
- i++; /* double increment to skip over .perm */
}
rsdb_transaction(RSDB_TRANS_END);