home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.gdb.bug
- Path: sparky!uunet!cis.ohio-state.edu!twinsun.COM!eggert
- From: eggert@twinsun.COM (Paul Eggert)
- Subject: environ.c should not apply memcpy to overlapping regions (GDB 4.6)
- Message-ID: <9207232340.AA20418@farside.twinsun.com>
- Sender: gnulists@ai.mit.edu
- Organization: GNUs Not Usenet
- Distribution: gnu
- Date: Thu, 23 Jul 1992 23:40:45 GMT
- Approved: bug-gdb@prep.ai.mit.edu
- Lines: 31
-
- GDB 4.6's environ.c applies the memcpy routine to overlapping regions of
- memory. This isn't portable. It should use memmove instead, but I suppose
- that's too much of a pain to configure. Here is a patch.
-
- ===================================================================
- RCS file: environ.c,v
- retrieving revision 4.6
- diff -c -r4.6 environ.c
- *** environ.c 1992/07/06 17:10:46 4.6
- --- environ.c 1992/07/23 23:27:13
- ***************
- *** 179,187 ****
- && s[len] == '=')
- {
- free (s);
- ! memcpy (vector, vector + 1,
- ! (e->allocated - (vector - e->vector)) * sizeof (char *));
- ! e->vector[e->allocated - 1] = 0;
- return;
- }
- }
- --- 179,186 ----
- && s[len] == '=')
- {
- free (s);
- ! while ((vector[0] = vector[1]) != NULL)
- ! vector++;
- return;
- }
- }
-
-