aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2018-06-01 10:49:40 -0600
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-07-20 00:25:38 +0000
commitf2a5ea888ef17cdc3ae55822b03b532393b388d6 (patch)
tree578be910dcb91b05d216f40f16b747cc4d51bb21
parent0c52721929b2d9d610b20e1a2ad099688947c781 (diff)
downloadandroid_external_e2fsprogs-f2a5ea888ef17cdc3ae55822b03b532393b388d6.tar.gz
android_external_e2fsprogs-f2a5ea888ef17cdc3ae55822b03b532393b388d6.tar.bz2
android_external_e2fsprogs-f2a5ea888ef17cdc3ae55822b03b532393b388d6.zip
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 (cherry picked from commit efe90c297a8df591c051fdbfacb92b5283390bba)
-rw-r--r--misc/blkid.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/misc/blkid.c b/misc/blkid.c
index 96fffae4..472f0179 100644
--- a/misc/blkid.c
+++ b/misc/blkid.c
@@ -87,7 +87,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);
+ }
}
}