changeset 2695:7d1568170fba

6442443 ipsecconf coredumps due to memory corruption in parse_pattern_or_prop()
author markfen
date Thu, 07 Sep 2006 15:46:35 -0700
parents 3ce7f0b0c9b5
children c7ee01eb6557
files usr/src/cmd/cmd-inet/usr.sbin/ipsecconf.c
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/cmd-inet/usr.sbin/ipsecconf.c	Thu Sep 07 14:27:28 2006 -0700
+++ b/usr/src/cmd/cmd-inet/usr.sbin/ipsecconf.c	Thu Sep 07 15:46:35 2006 -0700
@@ -3805,6 +3805,14 @@
 						warn("malloc");
 						return (ENOMEM);
 					}
+					if (strlen(tmp_buf) != 0) {
+						(void) strcpy(argvec[i],
+						    tmp_buf);
+						if (argindex >= ARG_BUF_LEN)
+							return (-1);
+						arg_indices[argindex++] =
+						    linecount;
+					}
 					/*
 					 * Copy the rest of the line into the
 					 * leftover buffer.
@@ -3815,14 +3823,6 @@
 					} else {
 						*leftover = NULL;
 					}
-					if (strlen(tmp_buf) != 0) {
-						(void) strcpy(argvec[i],
-						    tmp_buf);
-						if (argindex >= ARG_BUF_LEN)
-							return (-1);
-						arg_indices[argindex++] =
-						    linecount;
-					}
 					return (PARSE_SUCCESS);
 				} else {
 					*buf++ = NULL;