[PATCH] hush: stop parsing string at its end

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

 



remove_quotes_in_str() doesn't stop parsing at the string end when
there's a single "'" in the string.
Handling quotes and double quotes is broken in many ways in hush, so
I am not exactly sure this is the right thing to do, but at least it
avoids going out of the string boundaries.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 common/hush.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/common/hush.c b/common/hush.c
index 9ced67af48..44ce4e5225 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -623,8 +623,11 @@ static void remove_quotes_in_str(char *src)
 	while (*src) {
 		if (*src == '\'') {
 			src++;
-			while (*src != '\'')
+			while (*src != '\'') {
+				if (!*src)
+					return;
 				*trg++ = *src++;
+			}
 			src++;
 			continue;
 		}
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux