home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / gnu / gdb / bug / 894 < prev    next >
Encoding:
Text File  |  1992-07-25  |  1.2 KB  |  44 lines

  1. Newsgroups: gnu.gdb.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!twinsun.COM!eggert
  3. From: eggert@twinsun.COM (Paul Eggert)
  4. Subject: environ.c should not apply memcpy to overlapping regions (GDB 4.6)
  5. Message-ID: <9207232340.AA20418@farside.twinsun.com>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Thu, 23 Jul 1992 23:40:45 GMT
  10. Approved: bug-gdb@prep.ai.mit.edu
  11. Lines: 31
  12.  
  13. GDB 4.6's environ.c applies the memcpy routine to overlapping regions of
  14. memory.  This isn't portable.  It should use memmove instead, but I suppose
  15. that's too much of a pain to configure.  Here is a patch.
  16.  
  17. ===================================================================
  18. RCS file: environ.c,v
  19. retrieving revision 4.6
  20. diff -c -r4.6 environ.c
  21. *** environ.c    1992/07/06 17:10:46    4.6
  22. --- environ.c    1992/07/23 23:27:13
  23. ***************
  24. *** 179,187 ****
  25.       && s[len] == '=')
  26.         {
  27.       free (s);
  28. !     memcpy (vector, vector + 1,
  29. !         (e->allocated - (vector - e->vector)) * sizeof (char *));
  30. !     e->vector[e->allocated - 1] = 0;
  31.       return;
  32.         }
  33.   }
  34. --- 179,186 ----
  35.       && s[len] == '=')
  36.         {
  37.       free (s);
  38. !     while ((vector[0] = vector[1]) != NULL)
  39. !       vector++;
  40.       return;
  41.         }
  42.   }
  43.  
  44.