changeset 13375:5e6d930c0c9b

953 amd64 mdb chews arguments to ::run? Reviewed by: Dan McDonald <danmcd@nexenta.com> Reviewed by: Garrett D'Amore <garrett@nexenta.com> Reviewed by: Adam Leventhal <ahl@delphix.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Approved by: Gordon Ross <gwr@nexenta.com>
author Alexander Eremin <a.eremin@nexenta.com>
date Tue, 17 May 2011 12:36:01 -0400
parents b156817e002c
children c3f168efd1e4
files usr/src/cmd/mdb/common/mdb/mdb_lex.l
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/mdb/common/mdb/mdb_lex.l	Tue May 17 11:08:25 2011 -0400
+++ b/usr/src/cmd/mdb/common/mdb/mdb_lex.l	Tue May 17 12:36:01 2011 -0400
@@ -25,6 +25,10 @@
  * Use is subject to license terms.
  */
 
+/*
+ * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ */
+
 #include <sys/types.h>
 #include <sys/isa_defs.h>
 
@@ -673,7 +677,8 @@
 		 * the destination buffer past what we skipped.
 		 */
 		if (p > o) {
-			(void) strncpy(s, o, p - o);
+			/* Using memmove to prevent possible overlap. */
+			(void) memmove(s, o, p - o);
 			s += p - o;
 		}
 
@@ -696,7 +701,7 @@
 		 * and convert escape sequences if *p is double-quote.
 		 */
 		if (q > p + 1) {
-			(void) strncpy(s, p + 1, q - p - 1);
+			(void) memmove(s, p + 1, q - p - 1);
 			if (c == '"') {
                                 s[q - p - 1] = '\0';
 				s += stresc2chr(s);
@@ -707,7 +712,7 @@
 		p = q + 1; /* Advance p past matching quote */
 	}
 
-	(void) strcpy(s, o);
+	(void) memmove(s, o, strlen(o) + 1);
 }
 
 /*