mirror of
https://github.com/status-im/react-native.git
synced 2025-01-28 02:04:55 +00:00
fix output leaving bad characters in systrace output buffer due to overstepping bytes written
Differential Revision: D2658628 fb-gh-sync-id: e4c9dc66746177d371331d79972f1322239b4ea7
This commit is contained in:
parent
b7f5062128
commit
2f9e7be04b
@ -42,6 +42,7 @@ static size_t copyTruncatedAsciiChars(
|
||||
// rather than the beginning.
|
||||
size_t toWrite = min(stringLen, min(bufLen, maxLen));
|
||||
|
||||
const char *startBuf = buf;
|
||||
const JSChar* chars = JSStringGetCharactersPtr(jsString);
|
||||
while (toWrite-- > 0) {
|
||||
*(buf++) = (char)*(chars++);
|
||||
@ -49,8 +50,8 @@ static size_t copyTruncatedAsciiChars(
|
||||
|
||||
JSStringRelease(jsString);
|
||||
|
||||
// Return the full length to match snprintf semantics.
|
||||
return stringLen;
|
||||
// Return the number of bytes written
|
||||
return buf - startBuf;
|
||||
}
|
||||
|
||||
static size_t copyArgsToBuffer(
|
||||
|
Loading…
x
Reference in New Issue
Block a user