Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libedit Fix overlapping strcpy (Gerry Swislow)



details:   https://anonhg.NetBSD.org/src/rev/d168d63b3758
branches:  trunk
changeset: 807223:d168d63b3758
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Apr 01 15:23:15 2015 +0000

description:
Fix overlapping strcpy (Gerry Swislow)

diffstat:

 lib/libedit/readline.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 9f48dc15cb75 -r d168d63b3758 lib/libedit/readline.c
--- a/lib/libedit/readline.c    Wed Apr 01 15:20:58 2015 +0000
+++ b/lib/libedit/readline.c    Wed Apr 01 15:23:15 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readline.c,v 1.114 2015/03/24 21:29:52 christos Exp $  */
+/*     $NetBSD: readline.c,v 1.115 2015/04/01 15:23:15 christos Exp $  */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.114 2015/03/24 21:29:52 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.115 2015/04/01 15:23:15 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -979,7 +979,8 @@
                for (; str[j]; j++) {
                        if (str[j] == '\\' &&
                            str[j + 1] == history_expansion_char) {
-                               (void)strcpy(&str[j], &str[j + 1]);
+                               len = strlen(&str[j + 1]) + 1;
+                               memmove(&str[j], &str[j + 1], len);
                                continue;
                        }
                        if (!loop_again) {



Home | Main Index | Thread Index | Old Index