Index: src/ipmishell.c
===================================================================
RCS file: /cvsroot/ipmitool/ipmitool/src/ipmishell.c,v
retrieving revision 1.19
diff -u -r1.19 ipmishell.c
--- src/ipmishell.c	29 Mar 2013 14:40:21 -0000	1.19
+++ src/ipmishell.c	7 Jul 2013 13:12:30 -0000
@@ -146,7 +146,7 @@
 		while (*ptr != '\0') {
 			if (*ptr == '"') {
 				ptr++;
-				while (*ptr != '"') {
+				while (*ptr != '"' && *ptr != '\0') {
 					if (isspace((int)*ptr))
 						*ptr = '~';
 					ptr++;
@@ -154,7 +154,7 @@
 			}
 			if (*ptr == '\'') {
 				ptr++;
-				while (*ptr != '\'') {
+				while (*ptr != '\'' && *ptr != '\0') {
 					if (isspace((int)*ptr))
 						*ptr = '~';
 					ptr++;
@@ -174,7 +174,7 @@
 			ptr = *ap;
 			if (*ptr == '\'') {
 				memmove(ptr, ptr+1, strlen(ptr));
-				while (*ptr != '\'') {
+				while (*ptr != '\'' && *ptr != '\0') {
 					if (*ptr == '~')
 						*ptr = ' ';
 					ptr++;
@@ -183,7 +183,7 @@
 			}
 			if (*ptr == '"') {
 				memmove(ptr, ptr+1, strlen(ptr));
-				while (*ptr != '"') {
+				while (*ptr != '"' && *ptr != '\0') {
 					if (*ptr == '~')
 						*ptr = ' ';
 					ptr++;
@@ -366,7 +366,7 @@
 		while (*ptr != '\0') {
 			if (*ptr == '"') {
 				ptr++;
-				while (*ptr != '"') {
+				while (*ptr != '"' && *ptr != '\0') {
 					if (isspace((int)*ptr))
 						*ptr = '~';
 					ptr++;
@@ -374,7 +374,7 @@
 			}
 			if (*ptr == '\'') {
 				ptr++;
-				while (*ptr != '\'') {
+				while (*ptr != '\'' && *ptr != '\0') {
 					if (isspace((int)*ptr))
 						*ptr = '~';
 					ptr++;
@@ -405,7 +405,7 @@
 				tmp = __argv[__argc-1];
 				if (*tmp == '\'') {
 					memmove(tmp, tmp+1, strlen(tmp));
-					while (*tmp != '\'') {
+					while (*tmp != '\''  *tmp != '\0') {
 						if (*tmp == '~')
 							*tmp = ' ';
 						tmp++;
@@ -414,7 +414,7 @@
 				}
 				if (*tmp == '"') {
 					memmove(tmp, tmp+1, strlen(tmp));
-					while (*tmp != '"') {
+					while (*tmp != '"' && *tmp != '\0') {
 						if (*tmp == '~')
 							*tmp = ' ';
 						tmp++;
