🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #1570

GNU diff's BUG (on SYSV)

#1570
From: Toshiyuki Game Player Ito
Date: Mon, 24 Apr 1989 06:42
48 lines
1855 bytes
Dear FSF.

My name is ITO, TOSHIYUKI. 

I installed GNU diff(v.1.4) on SYSV.R2 machine. But It wasn't succeed because
free(2) bug? on SYSV.

I try to

% diff <file> <dir>

Usually it acts diff <file> <dir>/<file> on SYSV and BSD. GNU diff dumps
core(bus error). This bug is caused at line 479 in diff.c

	  free (inf[dir_arg].name);

In this case, inf[dir_arg].name may be argv[1] or argv[2]. So free(2) tries to
free *argv pointer on SYSV, and core dumped later. Because SYSV dose not check
free address.

I patched diff.c. (see below)

*** diff.c	Wed Apr  5 21:10:06 1989
--- ../gdiff/diff.c	Thu Apr 13 13:30:58 1989
***************
*** 292,298 ****
--- 292,302 ----
  
    switch_string = option_list (argv + 1, optind - 1);
  
+ #ifdef USG
+   val = compare_files (0, strcpy((char *) xmalloc(strlen(argv[optind]) + 1), argv[optind]), 0, strcpy((char *) xmalloc(strlen(argv[optind + 1]) + 1), argv[optind + 1]), 0);
+ #else
    val = compare_files (0, argv[optind], 0, argv[optind + 1], 0);
+ #endif
  
    /* Print any messages that were saved up for last.  */
    print_message_queue ();

I hope, this bug will be fixed, Thank you.

---------
          ITO, TOSHIYUKI
Office:   INFORMATION SYSTEMS & ELECTRONICS DEVELOPMENT LAB.
          MITSUBISHI ELECTRIC CORPORATION
Address:  5-1-1 OFUNA KAMAKURA 247, JAPAN
PHONE:    +81-467-44-9084
E-mail:   toshi%isl.melco.co.jp@uunet.uu.net
Technical Details
Message-ID: <8904240642.AA00308@saturn.isl.melco.junet>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!saturn.isl.melco.junet!toshi

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!saturn.isl.melco.junet!toshi
From: toshi@saturn.isl.melco.junet (Toshiyuki Game Player Ito)
Newsgroups: gnu.utils.bug
Subject: GNU diff's BUG (on SYSV)
Message-ID: <8904240642.AA00308@saturn.isl.melco.junet>
Date: 24 Apr 89 06:42:47 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 48