Merge "dexdump: fix a static analyzer complaint"
diff --git a/dexdump/DexDump.cpp b/dexdump/DexDump.cpp
index 7a20c29..8dbdd22 100644
--- a/dexdump/DexDump.cpp
+++ b/dexdump/DexDump.cpp
@@ -738,7 +738,8 @@
return false;
}
const char* param = dexStringByTypeIdx(pDexFile, paramTypes->list[i].typeIdx);
- size_t newUsed = bufUsed + strlen(param);
+ size_t paramLen = strlen(param);
+ size_t newUsed = bufUsed + paramLen;
if (newUsed > bufSize) {
char* newBuf = (char*)realloc(buf, newUsed);
if (newBuf == NULL) {
@@ -748,7 +749,7 @@
buf = newBuf;
bufSize = newUsed;
}
- strncat(buf + bufUsed - 1, param, bufSize - (bufUsed - 1));
+ memcpy(buf + bufUsed - 1, param, paramLen + 1);
bufUsed = newUsed;
}