OSDN Git Service

Do not log passwords returned through vdc
authorPaul Lawrence <paullawrence@google.com>
Tue, 11 Nov 2014 20:26:09 +0000 (12:26 -0800)
committerPaul Lawrence <paullawrence@google.com>
Tue, 2 Dec 2014 17:27:37 +0000 (09:27 -0800)
Requires framework change:
  https://googleplex-android-review.git.corp.google.com/#/c/585511/

Bug: 18260068
Change-Id: I95d3bb39404ede7128b8f5d61ce2423a5f09a9b8

CommandListener.cpp

index 4c65959..f135a01 100644 (file)
@@ -710,8 +710,14 @@ int CommandListener::CryptfsCmd::runCommand(SocketClient *cli,
         dumpArgs(argc, argv, -1);
         char* password = cryptfs_get_password();
         if (password) {
-            cli->sendMsg(ResponseCode::CommandOkay, password, false);
-            return 0;
+            char* message = 0;
+            int size = asprintf(&message, "{{sensitive}} %s", password);
+            if (size != -1) {
+                cli->sendMsg(ResponseCode::CommandOkay, message, false);
+                memset(message, 0, size);
+                free (message);
+                return 0;
+            }
         }
         rc = -1;
     } else if (!strcmp(argv[1], "clearpw")) {