home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume7 / patch2 / patch9 < prev    next >
Text File  |  1988-05-15  |  3KB  |  90 lines

  1. System: patch version 2.0
  2. Patch #: 9
  3. Priority: LOW
  4. Subject: Reversed new-style context diff can cause double free().
  5. From: lwall@sdcrdcf.UUCP
  6.  
  7. Description:
  8.     A new-style context diff that is reversed (-R) and that contains
  9.     a hunk with an assumed old or new half is not freed properly.
  10.     When there is a hunk-half assumed, the lines are duplicated
  11.     internally by copying the pointers of the actual lines from the
  12.     other half.  A pair of variables then tell the freeing routine
  13.     not to free that range of fake lines since they will be freed when
  14.     the other half hunk is freed.
  15.  
  16.     The problem is that the routine that swaps halves of the hunk didn't
  17.     update the variables to point to where the fake lines were moved to.
  18.  
  19. Fix:    From rn, say "| patch -d DIR", where DIR is your patch source
  20.     directory.  Outside of rn, say "cd DIR; patch <thisarticle".
  21.     If you don't have the patch program, apply the following by hand,
  22.     or get patch.
  23.  
  24.     If patch indicates that patchlevel is the wrong version, you may need
  25.     to apply one or more previous patches, or the patch may already
  26.     have been applied.  See the patchlevel.h file to find out what has or
  27.     has not been applied.  In any event, don't continue with the patch.
  28.  
  29.     If you are missing previous patches they can be obtained from me:
  30.  
  31.     Larry Wall
  32.     {allegra,burdvax,cbosgd,ihnp4,sdcsvax}!sdcrdcf!lwall
  33.  
  34.     If you send a mail message of the following form it will greatly speed
  35.     processing:
  36.  
  37.     Subject: Command
  38.     @SH mailpatch PATH patch 2.0 LIST
  39.            ^ note the c
  40.  
  41.     where PATH is a return path FROM ME TO YOU in bang notation, and LIST
  42.     is the number of one or more patches you need, separated by spaces,
  43.     commas, and/or hyphens.  Saying 35- says everything from 35 to the end.
  44.  
  45. Index: patchlevel.h
  46. Prereq: 8
  47. 1c1
  48. < #define PATCHLEVEL 8
  49. ---
  50. > #define PATCHLEVEL 9
  51.  
  52. Index: pch.c
  53. Prereq: 2.0.1.5
  54. *** pch.c.old    Thu Jun  4 16:20:28 1987
  55. *** pch.c    Thu Jun  4 16:20:43 1987
  56. ***************
  57. *** 1,6 ****
  58. ! /* $Header: pch.c,v 2.0.1.5 87/01/30 22:47:42 lwall Exp $
  59.    *
  60.    * $Log:    pch.c,v $
  61.    * Revision 2.0.1.5  87/01/30  22:47:42  lwall
  62.    * Improved responses to mangled patches.
  63.    * 
  64. --- 1,9 ----
  65. ! /* $Header: pch.c,v 2.0.1.6 87/06/04 16:18:13 lwall Exp $
  66.    *
  67.    * $Log:    pch.c,v $
  68. +  * Revision 2.0.1.6  87/06/04  16:18:13  lwall
  69. +  * pch_swap didn't swap p_bfake and p_efake.
  70. +  * 
  71.    * Revision 2.0.1.5  87/01/30  22:47:42  lwall
  72.    * Improved responses to mangled patches.
  73.    * 
  74. ***************
  75. *** 900,905 ****
  76. --- 903,915 ----
  77.       if (tp_char[i] == '\n') {        /* account for possible blank line */
  78.       blankline = TRUE;
  79.       i++;
  80. +     }
  81. +     if (p_efake >= 0) {            /* fix non-freeable ptr range */
  82. +     n = p_end - i + 1;
  83. +     if (p_efake > i)
  84. +         n = -n;
  85. +     p_efake += n;
  86. +     p_bfake += n;
  87.       }
  88.       for (n=0; i <= p_end; i++,n++) {
  89.       p_line[n] = tp_line[i];
  90.