Browse Source

make: fixed bug with overlapping memory areas (upstream fix)

bug #27148: Use of strcpy on overlapping memory areas
http://savannah.gnu.org/bugs/?27148
http://cvs.savannah.gnu.org/viewvc/make/job.c?root=make&r1=1.194&r2=1.195

2009-08-01  Paul Smith  <psmith@gnu.org>
        * job.c (new_job): Use memmove() instead of strcpy() since both
        pointers are in the same memory block.  Fixes Savannah bug #27148.
        Patch by Petr Machata.
user/karasz/next/updates
Christian Wiese 15 years ago committed by Christian Wiese
parent
commit
7880162498
  1. 41
      base/make/0001-fix-memory-area-overlap.patch

41
base/make/0001-fix-memory-area-overlap.patch

@ -0,0 +1,41 @@
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../make/0001-fix-memory-area-overlap.patch
# Copyright (C) 2010 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
bug #27148: Use of strcpy on overlapping memory areas
http://savannah.gnu.org/bugs/?27148
http://cvs.savannah.gnu.org/viewvc/make/job.c?root=make&r1=1.194&r2=1.195
2009-08-01 Paul Smith <psmith@gnu.org>
* job.c (new_job): Use memmove() instead of strcpy() since both
pointers are in the same memory block. Fixes Savannah bug #27148.
Patch by Petr Machata.
diff --git a/job.c b/job.c
index a81cd81..3251efe 100644
--- a/job.c
+++ b/job.c
@@ -1594,7 +1594,7 @@ new_job (struct file *file)
/* There are no more references in this line to worry about.
Copy the remaining uninteresting text to the output. */
if (out != in)
- strcpy (out, in);
+ memmove (out, in, strlen (in) + 1);
/* Finally, expand the line. */
lines[i] = allocated_variable_expand_for_file (cmds->command_lines[i],
--
1.6.5.3
Loading…
Cancel
Save