aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2018-06-01 10:49:40 -0600
committerJeff Sharkey <jsharkey@google.com>2018-06-01 16:51:25 +0000
commitefe90c297a8df591c051fdbfacb92b5283390bba (patch)
tree1a442b76c7c35af5dafb58990a0b648867589f33
parentb2cc45fe711dc42c8c0444584b2513ac59b3ad3b (diff)
downloade2fsprogs-efe90c297a8df591c051fdbfacb92b5283390bba.tar.gz
Ignore quotes in safe_print().
If the value being printed has embedded quotes ("), then printing those quotes could confuse other tools when parsing the value. This is the simplest CL to fix the security issue, and we can circle back to think about more robust escaping in a future CL. Bug: 80436257 Test: manual Change-Id: Ica17f2c5701573bceafe34f20110d230a3925483
-rw-r--r--misc/blkid.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/misc/blkid.c b/misc/blkid.c
index 388abad0..248cacf6 100644
--- a/misc/blkid.c
+++ b/misc/blkid.c
@@ -86,7 +86,9 @@ static void safe_print(const char *cp, int len)
fputc('^', stdout);
ch ^= 0x40; /* ^@, ^A, ^B; ^? for DEL */
}
- fputc(ch, stdout);
+ if (ch != '"') {
+ fputc(ch, stdout);
+ }
}
}