summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Butler <butlermichael@google.com>2017-04-26 18:25:16 -0700
committerMichael Butler <butlermichael@google.com>2017-04-27 14:04:09 -0700
commita25174fddaed975e63cddc8d05207d2943cdeee6 (patch)
treee5d811c56c6fe7c54aff567a8b5231c9990864d4
parentc46ffabe6e727c656d241d5642df88b722714eca (diff)
downloadrs-a25174fddaed975e63cddc8d05207d2943cdeee6.tar.gz
Append null terminator to fullPath variable and change sizeof(type) to
sizeof(*name) for clarity. Fixes minor issues addressed in aosp/380576 Bug: 32511607 Test: mma, cts, vts Change-Id: I8f2eca4bcc8c93671668a542dc6117df58979b56 (cherry picked from commit 94979da78cf5762c609a04dd42527edae03719a8)
-rw-r--r--cpu_ref/rsCpuCore.cpp2
-rw-r--r--rsFont.cpp1
2 files changed, 2 insertions, 1 deletions
diff --git a/cpu_ref/rsCpuCore.cpp b/cpu_ref/rsCpuCore.cpp
index f4f9c4c9..7fcaef9f 100644
--- a/cpu_ref/rsCpuCore.cpp
+++ b/cpu_ref/rsCpuCore.cpp
@@ -483,7 +483,7 @@ static const int kFormatInBytesMax = 16;
// ": " + 2 digits per byte + 1 separator between bytes + "..." + null
typedef char FormatBuf[2 + kFormatInBytesMax*2 + (kFormatInBytesMax - 1) + 3 + 1];
static const char *format_bytes(FormatBuf *outBuf, const uint8_t *inBuf, const int inBytes) {
- strlcpy(*outBuf, ": ", sizeof(FormatBuf));
+ strlcpy(*outBuf, ": ", sizeof(*outBuf));
int pos = 2;
const int lim = std::min(kFormatInBytesMax, inBytes);
for (int i = 0; i < lim; ++i) {
diff --git a/rsFont.cpp b/rsFont.cpp
index f204f597..511bf627 100644
--- a/rsFont.cpp
+++ b/rsFont.cpp
@@ -757,6 +757,7 @@ void FontState::renderText(const char *text, uint32_t len, int32_t x, int32_t y,
rsAssert(strlen(root) < 256);
strlcpy(fullPath, root, sizeof(fullPath));
strlcat(fullPath, "/fonts/Roboto-Regular.ttf", sizeof(fullPath));
+ fullPath[sizeof(fullPath)-1] = '\0';
mDefault.set(Font::create(mRSC, fullPath, 8, mRSC->getDPI()));
}
currentFont = mDefault.get();