mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] hush: stop parsing string at its end
@ 2021-01-27  8:19 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2021-01-27  8:19 UTC (permalink / raw)
  To: Barebox List

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@pengutronix.de>
---
 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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-27  8:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27  8:19 [PATCH] hush: stop parsing string at its end Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox