Skip to content

Commit a96ff32

Browse files
ggggamerminggo
authored andcommitted
Fix isVariable method buffer overflow. (#20376)
1 parent a217661 commit a96ff32

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cocos/base/CCProperties.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ static bool isVariable(const char* str, char* outName, size_t outSize)
139139
size_t size = len - 3;
140140
if (size > (outSize - 1))
141141
size = outSize - 1;
142-
strncpy(outName, str + 2, len - 3);
143-
outName[len - 3] = 0;
142+
strncpy(outName, str + 2, size);
143+
outName[size] = 0;
144144
return true;
145145
}
146146

0 commit comments

Comments
 (0)