🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #1465

Diff 1.4 bug with directory comparisons

#1465
From: 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;
      }
  
Technical Details
Message-ID: <512@didsgn.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!gatech!rebel!didsgn!root

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!gatech!rebel!didsgn!root
From: root@didsgn.UUCP (didsgn)
Newsgroups: gnu.utils.bug
Subject: Diff 1.4 bug with directory comparisons
Message-ID: <512@didsgn.UUCP>
Date: 23 Jan 89 20:10:04 GMT
Distribution: gnu
Organization: Digital Design Inc., Norcross GA
Lines: 41