🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by didsgn Mon, 23 Jan 1989 20:10
Diff 1.4 bug with directory comparisons
#1465
Author: didsgn
Date: Mon, 23 Jan 1989 20:10
41 lines
1601 bytes
I have found a strange effect (a core dump :-) when the -N option is used
on diff 1.4 and you are trying to compare two directories. If in one of
the directories a binary file is found, but there is no such file in the
other directory, diff dumps. The problem is in analyze.c where it does
the comparison of the binary files. After the comparison, diff_2_files()
does a free() on the buffers that were allocated to read in the file's data.
However, since one file did not exist, the buffer didn't exist either
and a free(0) was attempted which caused the problem.

-Allan G. Schrum

 Digital Design, Inc.
 3060 Business Park Drive, Ste E
 Norcross, GA 30071

 (404) 447-0274

 ...!gatech!rebel!didsgn!allan

Below is a diff of analyze.c with the correction:

*** analyze.c	Mon Jan 23 14:59:57 1989
--- old_analyze.c	Mon Jan 23 14:59:12 1989
*************** diff_2_files (filevec, depth
*** 671,678 ****
  		 filevec[0].name, filevec[1].name);
  
        for (i = 0; i < 2; ++i)
! 	if ( filevec[i].buffer )
! 	  free (filevec[i].buffer);
        return differs;
      }
  
--- 671,677 ----
  		 filevec[0].name, filevec[1].name);
  
        for (i = 0; i < 2; ++i)
! 	free (filevec[i].buffer);
        return differs;
      }
  
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads