From 19b500bd505dce85d90f5be6f318399aed9cc990 Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Fri, 21 Feb 2020 14:36:31 -0800 Subject: [PATCH] incremental_server: fix a use of uninitalized memory Without this, the caller is likely to assume that their buffer is fully usable, which clang's analyzer doesn't believe is the case. Another option is to set `*size` to nonzero. Caught by the static analyzer: system/core/adb/client/incremental_server.cpp:111:31: warning: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage] Bug: None Test: TreeHugger Change-Id: Ib844aa4ab3ebb297ca8f6f4289bbe3212275275b --- adb/client/incremental_server.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adb/client/incremental_server.cpp b/adb/client/incremental_server.cpp index 726533d2a..585e50c44 100644 --- a/adb/client/incremental_server.cpp +++ b/adb/client/incremental_server.cpp @@ -258,7 +258,7 @@ bool IncrementalServer::SkipToRequest(void* buffer, size_t* size, bool blocking) if (r == -1) { fprintf(stderr, "Failed to read from fd %d: %d. Exit\n", adb_fd_.get(), errno); - return true; + return false; } // socket is closed