From d58b490479bbde719d3e8626382c04829be6bbca Mon Sep 17 00:00:00 2001 From: Martin Hibdon Date: Tue, 8 Apr 2014 13:35:13 -0700 Subject: [PATCH] Fix a potential stack overflow error b/13906567 Change-Id: I21be980d4b4878ada0df6d3af706fee55afb4f2b --- src/com/android/email/mail/store/ImapConnection.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/android/email/mail/store/ImapConnection.java b/src/com/android/email/mail/store/ImapConnection.java index 2e9019edd..972eda2c1 100644 --- a/src/com/android/email/mail/store/ImapConnection.java +++ b/src/com/android/email/mail/store/ImapConnection.java @@ -275,6 +275,11 @@ class ImapConnection { throws MessagingException, IOException { LogUtils.d(Logging.LOG_TAG, "sendCommand %s", (sensitive ? IMAP_REDACTED_LOG : command)); open(); + return sendCommandInternal(command, sensitive); + } + + String sendCommandInternal(String command, boolean sensitive) + throws MessagingException, IOException { String tag = Integer.toString(mNextCommandTag.incrementAndGet()); String commandToSend = tag + " " + command; mTransport.writeLine(commandToSend, sensitive ? IMAP_REDACTED_LOG : null); @@ -542,7 +547,7 @@ class ImapConnection { private ImapResponse getOAuthResponse() throws IOException, MessagingException { ImapResponse response; - sendCommand(getLoginPhrase(), true); + sendCommandInternal(getLoginPhrase(), true); do { response = mParser.readResponse(); } while (!response.isTagged() && !response.isContinuationRequest()); @@ -553,7 +558,7 @@ class ImapConnection { // Currently, the only type of authentication we support is OAuth. The only case where // it will send a continuation request is when we fail to authenticate. We need to // reply with a CR/LF, and it will then return with a NO response. - sendCommand("", true); + sendCommandInternal("", true); response = readResponse(); }