aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2022-08-28 11:10:13 +0100
committerRon Yorston <rmy@pobox.com>2022-08-28 11:10:13 +0100
commit182e489d9bc1b935fc5494b5c9ef47f47a6173d5 (patch)
treeea8d3289bd436a9306b16d38f2e4c72c96403bdb
parent67a630e5af1ace1dd528ea9652ee69102b3136c3 (diff)
downloadbusybox-w32-182e489d9bc1b935fc5494b5c9ef47f47a6173d5.tar.gz
busybox-w32-182e489d9bc1b935fc5494b5c9ef47f47a6173d5.tar.bz2
busybox-w32-182e489d9bc1b935fc5494b5c9ef47f47a6173d5.zip
make: fix incorrect handling of escaped newline
Fix a bug in process_command() where an escaped newline followed by a character other than tab resulted in premature termination of the command.
-rw-r--r--miscutils/make.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/miscutils/make.c b/miscutils/make.c
index b92819266..21d0ede51 100644
--- a/miscutils/make.c
+++ b/miscutils/make.c
@@ -1402,11 +1402,10 @@ process_command(char *s)
1402 // Remove tab following escaped newline. Stop processing at a 1402 // Remove tab following escaped newline. Stop processing at a
1403 // non-escaped newline. 1403 // non-escaped newline.
1404 for (t = u = s; *u && *u != '\n'; u++) { 1404 for (t = u = s; *u && *u != '\n'; u++) {
1405 if (u[0] == '\\' && u[1] == '\n' && u[2] == '\t') { 1405 *t++ = *u;
1406 *t++ = *u++; 1406 if (u[0] == '\\' && u[1] == '\n') {
1407 *t++ = *u++; 1407 *t++ = '\n';
1408 } else { 1408 u += (u[2] == '\t') ? 2 : 1;
1409 *t++ = *u;
1410 } 1409 }
1411 } 1410 }
1412 *t = '\0'; 1411 *t = '\0';