From ef3ea01f51ef6a56c3c058114019f63200aec94e Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sat, 19 Nov 2005 12:30:32 +0000 Subject: [PATCH] Fixed crash when receiving bad tics --- ChangeLog | 3 +++ mbfido/orphans.c | 1 + mbfido/tic.c | 11 ++++++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9affbf3d..ef822870 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ $Id$ v0.83.2 16-Nov-2005 + mbfido: + Fixed crash when receiving bad tics. + v0.83.1 12-Nov-2005 - 16-Nov-2005 diff --git a/mbfido/orphans.c b/mbfido/orphans.c index 6dc8a1b1..58e15d26 100644 --- a/mbfido/orphans.c +++ b/mbfido/orphans.c @@ -52,6 +52,7 @@ void fill_orphans(orphans **qal, char *TicName, char *Area, char *FileName, int orphans *tmp; tmp = (orphans *)malloc(sizeof(orphans)); + tmp->next = *qal; snprintf(tmp->TicName, 13, TicName); snprintf(tmp->Area, 21, Area); snprintf(tmp->FileName, 81, FileName); diff --git a/mbfido/tic.c b/mbfido/tic.c index 947ff952..64d71bbd 100644 --- a/mbfido/tic.c +++ b/mbfido/tic.c @@ -64,7 +64,7 @@ int Tic() DIR *dp; struct dirent *de; struct stat sbuf; - int i, rc = 0; + int i, rc = 0, first = TRUE; fd_list *fdl = NULL; orphans *opl = NULL, *tmp; @@ -153,9 +153,14 @@ int Tic() CreateSema((char *)"mbindex"); Syslog('f', "start tidy_orphans()"); - for (tmp = opl; tmp; tmp = opl->next) { + for (tmp = opl; tmp; tmp = tmp->next) { + if (first) { + Syslog('f', "TIC file TIC area Filename ORP CRC"); + Syslog('f', "------------ -------------------- ------------ --- ---"); + first = FALSE; + } Syslog('f', "%-12s %-20s %-12s %s %s", tmp->TicName, tmp->Area, tmp->FileName, - tmp->Orphaned ? "ORP" : "n/a", tmp->BadCRC ? "CRC" : "n/a"); + tmp->Orphaned ? "Yes" : "No ", tmp->BadCRC ? "Yes" : "No "); } tidy_orphans(&opl);