Don't crash on empty ticfiles

This commit is contained in:
Michiel Broek 2007-02-13 15:52:44 +00:00
parent 424bb3d4e4
commit 40aabda8c7
2 changed files with 19 additions and 11 deletions

View File

@ -14,6 +14,9 @@ v0.91.3 11-Feb-2007
The check filebase command now also removes dead symlinks from The check filebase command now also removes dead symlinks from
the download directories. the download directories.
mbfido:
Don't crash on empty ticfiles.
mbtask: mbtask:
Some code cleanup. Some code cleanup.
Fixed s SIGBUS on Sparc/NetBSD systems. Fixed s SIGBUS on Sparc/NetBSD systems.
@ -21,7 +24,7 @@ v0.91.3 11-Feb-2007
mbsebbs: mbsebbs:
Some debuglog cleanup. Some debuglog cleanup.
nbsetup: mbsetup:
In generated html sitedocs fixed link from node to tic areas. In generated html sitedocs fixed link from node to tic areas.

View File

@ -4,7 +4,7 @@
* Purpose ...............: Process .tic files * Purpose ...............: Process .tic files
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -157,16 +157,8 @@ int Tic()
/* /*
* Handle the array with orphaned and bad crc ticfiles. * Handle the array with orphaned and bad crc ticfiles.
*/ */
// Syslog('f', "start tidy_orphans()");
Now = time(NULL); Now = time(NULL);
for (tmp = opl; tmp; tmp = tmp->next) { for (tmp = opl; tmp; tmp = tmp->next) {
// if (first) {
// Syslog('f', "TIC file TIC area Filename ORP CRC DEL");
// Syslog('f', "------------ -------------------- ------------ --- --- ---");
// first = FALSE;
// }
// Syslog('f', "%-12s %-20s %-12s %s %s %s", tmp->TicName, tmp->Area, tmp->FileName,
// tmp->Orphaned ? "Yes" : "No ", tmp->BadCRC ? "Yes" : "No ", tmp->Purged ? "Yes":"No ");
/* /*
* Bad CRC and not marked purged are real crc errors. * Bad CRC and not marked purged are real crc errors.
@ -216,7 +208,7 @@ int Tic()
/* /*
* Returns 1 if error, 0 if ok. * Returns > 0 if error, 0 if ok.
*/ */
int LoadTic(char *inb, char *tfn, orphans **opl) int LoadTic(char *inb, char *tfn, orphans **opl)
{ {
@ -391,6 +383,19 @@ int LoadTic(char *inb, char *tfn, orphans **opl)
} }
fclose(tfp); fclose(tfp);
/*
* Do some basic checks on the loaded ticfile.
*/
if ( (strlen(TIC.TicIn.File) == 0) || (strlen(TIC.TicIn.Area) == 0) ||
(strlen(TIC.TicIn.From) == 0) || (strlen(TIC.TicIn.Origin) == 0)) {
WriteError("TIC file %s misses important information", TIC.TicName);
tidy_falist(&sbl);
mover(TIC.TicName);
tic_in++;
tic_bad++;
return 1;
}
if (TIC.TicIn.TotLDesc) { if (TIC.TicIn.TotLDesc) {
/* /*
* First check for a bug in Harald Harms Allfix program that * First check for a bug in Harald Harms Allfix program that