This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] [BZ #2703] envz_strip() invokes memmove() with erroneously reversed src and dest parameters.
- From: Ryan Arnold <rsa at us dot ibm dot com>
- To: libc-alpha at sourceware dot org, Joy dot lists at gmail dot com
- Date: Fri, 02 Jun 2006 13:25:59 -0500
- Subject: [PATCH] [BZ #2703] envz_strip() invokes memmove() with erroneously reversed src and dest parameters.
[BZ #2703] http://sources.redhat.com/bugzilla/show_bug.cgi?id=2703
The envz_strip() function works incorrectly (either incompletely or with
a segmentation violation) due to erroneously reversed src and dest
parameters to a memmove() invocation. Sean Lee found the problem and
suggested a fix. I created a testcase, verified the problem, tried the
suggested fix and created the following patch.
--
Ryan S. Arnold <rsa@us.ibm.com>
IBM Linux Technology Center
Linux on Power Toolchain
2006-06-02 Ryan S. Arnold <rsa@us.ibm.com>
* string/envz.c (envz_strip): correct erroneously reversed src
and dest parameters to memmove() invocation to correct bug
that causes segmentation violation or incomplete envz_strip()
behavior.
--- glibc-orig/string/envz.c 2006-06-01 16:21:22.000000000 -0500
+++ glibc/string/envz.c 2006-06-02 10:40:16.236175458 -0500
@@ -165,7 +165,7 @@
left -= entry_len;
if (! strchr (entry, SEP))
/* Null entry. */
- memmove (entry + entry_len, entry, left);
+ memmove (entry, entry + entry_len, left);
else
entry += entry_len;
}